Results 1 to 13 of 13
  1. #1
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow

    [Source Code] Combat Arms CBL Stat Extractor.

    Hey guys, I wrote this for Bombsaway707 a little while ago and figured I may as well share it with everyone. It basically extracts all the info about a certain player via their CBL page. It uses Regular Expressions for the most part to do all the extraction. Please make an effort to understand the code before using it. All I ask is that if you use this code, please have the consideration to credit me for it when you use it.

    See notes contained within the source for what controls you need.

    Here you go:

    [php]
    '~~~~~~CBL STAT EXTRACTOR BY JASON OF MPGH~~~~~~'

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
    '\\\\\\ Any member of MPGH is entitled to \\\\\\'
    '\\\\\\ make use of the following source \\\\\\'
    '\\\\\\ code on the condition that credit \\\\\\'
    '\\\\\\ is given to me for the original. \\\\\\'
    '\\\\\\ I hope you enjoy. - Jason of MPGH \\\\\\'
    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

    Imports System.Text.RegularExpressions

    Public Class Form1
    'for this particular code, you will first need to create a DataGridView, with two "TextBoxCell" columns'
    'set their "HeaderText" property to something you feel is appropriate (it makes no difference) and your'
    'ready to compile!'

    'create a list to store all the stats.'
    Private StatList As New List(Of Stats)
    'this is the RegEx pattern to extract a block of stats'
    Private Const Pattern As String = _
    "<tr>" & "[\s\S]" & _
    " <td class=""item"">.+</td>" & "[\s\S]" & _
    " <td class=""value"">.+</td>" & "[\s\S]" & _
    "[\s\S]" & _
    " <td class=""item"">.+</td>" & "[\s\S]" & _
    " <td class=""value"">.+</td>" & "[\s\S]" & _
    " </tr>"

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'get the stats of the specified player.'
    GetPlayerStats("JR_Pwnage")
    End Sub

    'the following is the sub procedure that will obtain the stats of a certain player and display them in'
    'a datagridview.'
    Private Sub GetPlayerStats(ByVal playerName As String)
    'clear the current player'
    DataGridView1. Rows.Clear()
    'define pagesource'
    Dim PageSource As String
    'download the pagesource of the specific player'
    Using wc As New Net.WebClient
    PageSource = wc.DownloadString("https://player.thecaconline.net/" & playerName & ".html")
    End Using
    'get all the stats from the pagesource in a big block!'
    Dim statCollection As MatchCollection = Regex.Matches(PageSource, Pattern)
    'work through each big block and get what we want!'
    For Each m As Match In statCollection
    'split the block into lines, and then use the indexes to specific lines to get what we want'
    Dim intoArray() As String = m.Value.Split(ChrW(10))
    Dim header1 As String = Regex.Match(intoArray(1), "(?<=<td class=""item"">).+(?=</td>)").Value
    Dim header2 As String = Regex.Match(intoArray(4), "(?<=<td class=""item"">).+(?=</td>)").Value
    Dim content1 As String = Regex.Match(intoArray(2), "(?<=<td class=""value"">).+(?=</td>)").Value
    Dim content2 As String = Regex.Match(intoArray(5), "(?<=<td class=""value"">).+(?=</td>)").Value
    'this is for the equipment, which doesnt follow the exact pattern of the previous entries'
    If content1.StartsWith("<a href") Then
    content1 = Regex.Match(content1, "(?<=<a href="".+"" data-tooltip="".+"">).+(?=</a>)").Value
    End If

    If content2.StartsWith("<a href") Then
    content2 = Regex.Match(content2, "(?<=<a href="".+"" data-tooltip="".+"">).+(?=</a>)").Value
    End If
    'add the two new stats to the statlist!'
    StatList.Add(New Stats With {.Stat = header1, .Value = content1})
    StatList.Add(New Stats With {.Stat = header2, .Value = content2})
    Next

    'add each entry to the datagridview. Alternatively you can just set the datasource of the '
    'DGV to "StatList", but that means changing the property names to what you want the column'
    'headers to be, so I figured this would be easier to follow'
    For Each s As Stats In StatList
    Dim row As New DataGridViewRow
    row.Cells.AddRange(New DataGridViewTextBoxCell() {New DataGridViewTextBoxCell With {.Value = s.Stat}, New DataGridViewTextBoxCell With {.Value = s.Value}})
    DataGridView1. Rows.Add(row)
    Next
    End Sub

    End Class

    'the class I created for the stats.'
    Public Class Stats
    Private HeaderName As String = ""
    Private Contents As String = ""

    'this holds the stat name (i.e Backpack A...etc)'
    Public Property Stat() As String
    Get
    Return HeaderName
    End Get
    Set(ByVal value As String)
    HeaderName = value
    End Set
    End Property

    'The value of the stat above (i.e L96A1...etc)'
    Public Property Value() As String
    Get
    Return Contents
    End Get
    Set(ByVal value As String)
    Contents = value
    End Set
    End Property
    End Class
    [/php]

    Enjoy guys, hope someone gets something out of this!

    Jason
    Last edited by Jason; 12-04-2010 at 10:35 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  2. The Following 8 Users Say Thank You to Jason For This Useful Post:

    ♪~ ᕕ(ᐛ)ᕗ (12-06-2010),Blubb1337 (12-04-2010),Hassan (12-05-2010),Lolland (12-04-2010),NextGen1 (12-04-2010),Obama (12-04-2010),Void (12-04-2010),why06 (12-07-2010)

  3. #2
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    Regex

    Good job Jason, thanks for sharing!

  4. #3
    Obama's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    The Black house
    Posts
    22,195
    Reputation
    870
    Thanks
    6,076
    My Mood
    Cool
    Thanks for sharing, we appreciate it

  5. #4
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Agreed, Looks very good.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  6. #5
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Why thank you

    Yes, Regex

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  7. #6
    Physcadelic's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Australia <3
    Posts
    4,450
    Reputation
    323
    Thanks
    828
    My Mood
    Breezy
    This is really cool...

    R.I.P a great GM




    Quote Originally Posted by Assalamu alaikum View Post
    what? maybe stop talk with riddles and with words i am not even know.

  8. #7
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Physcadelic View Post
    This is really cool...
    Cheers man

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  9. #8
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Wow! Niceeeeeeeeee
    /Thanked xD

  10. #9
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by AcE.bu50t View Post
    Wow! Niceeeeeeeeee
    /Thanked xD
    Thanks, glad you liked it.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  11. #10
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Quote Originally Posted by Jason View Post


    Thanks, glad you liked it.
    Well, No problem, it looks so awsum!
    I love the method that you use to code, it looks so advanced! SHIT!

  12. #11
    Sydney's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Germany...
    Posts
    1,356
    Reputation
    37
    Thanks
    1,144
    My Mood
    Amused
    Thank you. Epic

    Thanks Cosmos


  13. #12
    Fabolous's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    192.168.1.01
    Posts
    2,704
    Reputation
    261
    Thanks
    682
    My Mood
    Paranoid
    Just made it even more advanced but credits to you for starting me + src.

  14. #13
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by UnknownCoder View Post
    Just made it even more advanced but credits to you for starting me + src.
    Haha nice one, care to share what you added to make in more advanced?

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)