GSM Shop GSM Shop
GSM-Forum  

Welcome to the GSM-Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features.
Only registered members may post questions, contact other members or search our database of over 8 million posts.

Registration is fast, simple and absolutely free so please - Click to REGISTER!

If you have any problems with the registration process or your account login, please contact contact us .

Go Back   GSM-Forum > Other Gsm/Mobile Related Forums > GSM Programming & Reverse Engineering


GSM Programming & Reverse Engineering Here you can post all Kind of GSM Programming and Reverse Engineering tools and Secrets.

Reply
 
LinkBack Thread Tools Display Modes
Old 08-06-2012, 01:13   #1 (permalink)
Freak Poster
 
Join Date: Mar 2007
Posts: 187
Member: 460280
Status: Offline
Thanks Meter: 73
Read BB5 Full PM via USB Sample


I am a GSM enthusiast not a programmer, but I like programming my own tool. This forum have helped me a lot.

My progress:
1. Read BB5 phone info (detailed) via USB
2. Make Pm120 and 308 backup
3. SIM Lock counter reset
4. Read/write Product code, BPN, Hardware version, Order Number (alpha-numeric)
5. Read/write lock code
6. Reset Lock code counter

All sources was based on the tutorials I learned from here:
1. by fr3nsis
2. by shadab_a4u
3. by orbita
4. by angel25dz
5. by others I can't remember now

Now, my dear tutors, once again I needed your help.

I wanted to know/learn how to READ FULL PM from a BB5 phone via USB in VB.NET

1. How will I know the number of fields of PM of one BB5 phone?
2. What USB Frame will I use?
3. How will I loop so what my code will not so lengthy?

Please if you could provide sample source code that will help me a lot and will be highly appreciated.

I know that there is or are sources posted already but they are in delphi, and I don't understand much of delphi. VB.net is the easiest language for me.

Thank a lot. I'll be waiting.


BR,

John

P.S.

If it is not possible to post code here, please do it in PM. Thanks.

Last edited by John Q.; 08-06-2012 at 01:19.
  Reply With Quote
Old 08-06-2012, 08:38   #2 (permalink)
No Life Poster
 
MOURAD™'s Avatar
 
Join Date: Mar 2007
Location: Guangzhou-China
Posts: 1,289
Member: 468587
Status: Offline
Sonork: 100.1612429
Thanks Meter: 681
Quote:
Originally Posted by John Q. View Post
I am a GSM enthusiast not a programmer, but I like programming my own tool. This forum have helped me a lot.

My progress:
1. Read BB5 phone info (detailed) via USB
2. Make Pm120 and 308 backup
3. SIM Lock counter reset
4. Read/write Product code, BPN, Hardware version, Order Number (alpha-numeric)
5. Read/write lock code
6. Reset Lock code counter

All sources was based on the tutorials I learned from here:
1. by fr3nsis
2. by shadab_a4u
3. by orbita
4. by angel25dz
5. by others I can't remember now

Now, my dear tutors, once again I needed your help.

I wanted to know/learn how to READ FULL PM from a BB5 phone via USB in VB.NET

1. How will I know the number of fields of PM of one BB5 phone?
2. What USB Frame will I use?
3. How will I loop so what my code will not so lengthy?

Please if you could provide sample source code that will help me a lot and will be highly appreciated.

I know that there is or are sources posted already but they are in delphi, and I don't understand much of delphi. VB.net is the easiest language for me.

Thank a lot. I'll be waiting.


BR,

John

P.S.

If it is not possible to post code here, please do it in PM. Thanks.

You can find all this in BEST.rar


Best Regard
  Reply With Quote
The Following 2 Users Say Thank You to MOURAD™ For This Useful Post:
Old 08-06-2012, 08:48   #3 (permalink)
Freak Poster
 
Join Date: Mar 2007
Posts: 187
Member: 460280
Status: Offline
Thanks Meter: 73
Quote:
Originally Posted by Mrd07 View Post
You can find all this in BEST.rar


Best Regard

Thanks my friend, but it's in delphi, and as I've mentioned above delphi is beyond my knowledge.
  Reply With Quote
Old 08-06-2012, 10:01   #4 (permalink)
No Life Poster
 
platforms's Avatar
 
Join Date: Sep 2004
Location: London
Age: 43
Posts: 520
Member: 83090
Status: Offline
Sonork: 1626857
Thanks Meter: 52
loop between 0-512. Same way you read field 120 or 380
  Reply With Quote
Old 08-09-2012, 02:13   #5 (permalink)
Freak Poster
 
Join Date: Mar 2007
Posts: 187
Member: 460280
Status: Offline
Thanks Meter: 73
Quote:
Originally Posted by platforms View Post
loop between 0-512. Same way you read field 120 or 380
Thanks, but how do I do this? Please I need more 'specific' guide/sample.


BR,
John
  Reply With Quote
Old 08-09-2012, 05:44   #6 (permalink)
Freak Poster
 
Join Date: Jul 2011
Location: Australia/Melbourne
Posts: 122
Member: 1610809
Status: Offline
Sonork: 100.1616347
Thanks Meter: 23
this just a little exemple delphi , u can transleet to VB.net
look like this

Quote:
if (i=0) or
(i=1) or
(i=2) or
(i=3) or
(i=4) or
(i=7) or
(i=8) or
(i=11) or
(i=12) or
(i=21) or
(i=26) or
(i=31) or
(i=43) or
(i=44) or
(i=46) or
(i=50) or
(i=54) or
(i=88) or
(i=96) or
(i=107) or
(i=112) or
(i=117) or
(i=120) or
(i=193) or
(i=208) or
(i=212) or
(i=217) or
(i=239) or
(i=291) or
(i=296) or
(i=307) or
(i=308) or
(i=309) or
(i=313) or
(i=322) or
(i=326) or
(i=329) or
(i=334) or
(i=341) or
(i=354) or
(i=355) or
(i=356) or
(i=363) then

Reault_STR:= REaD_Frame('1B 00 10 23 00 06 00 0D 03 0E' + PM_Int , 100, 100); //30 50


For j := 11 to USB_RX -1 Do {28 to 29}
Begin
Tmp:=ord(USB_out_Buffer[j]);
Reault_STR := Reault_STR + ((IntToHex(INT,2) + ''));
end;

added memo2 to insert result and savetofile ext*.pm
memo2.savetofile....
  Reply With Quote
The Following User Says Thank You to GTunlocker For This Useful Post:
Old 08-25-2012, 12:34   #7 (permalink)
Freak Poster
 
Join Date: Dec 2002
Location: ...
Posts: 222
Member: 18642
Status: Offline
Thanks Meter: 44
Based on the following working code, I would like to upload a fixed value of the unsecured filed 356 (like below). For example, by clicking a Button5_Click.

[356]
0=0100
1=F22A000000000100

How is the easiest way to do this?
Could someone give an example of how to realize this in VB?

Code:
Imports Microsoft.Win32.SafeHandles
Imports System.Runtime.InteropServices
Imports System.Threading
Public Class Form1
    Dim success As Boolean
    Dim numberOfBytesWritten, numberOfBytesRead As Integer
    Dim unManagedBuffer As IntPtr
    Dim unManagedOverlapped As IntPtr
    Dim deviceHandle As SafeFileHandle
    Dim str As String

    Friend Const FILE_ATTRIBUTE_NORMAL As Int32 = &H80
    Friend Const FILE_FLAG_OVERLAPPED As Int32 = &H40000000
    Friend Const FILE_SHARE_READ As Int32 = 1
    Friend Const FILE_SHARE_WRITE As Int32 = 2
    Friend Const GENERIC_READ As UInt32 = &H80000000UL
    Friend Const GENERIC_WRITE As UInt32 = &H40000000
    Friend Const OPEN_EXISTING As Int32 = 3

    Public Structure SP_DEVICE_INTERFACE_DATA
        Dim cbSize As Int32
        Dim InterfaceClassGuid As Guid
        Dim Flags As Int32
        Dim Reserved As IntPtr
    End Structure

    <DllImport("setupapi.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Shared Function SetupDiGetClassDevs _
(ByRef ClassGuid As System.Guid, _
ByVal Enumerator As IntPtr, _
ByVal hwndParent As IntPtr, _
ByVal Flags As Int32) _
As IntPtr
    End Function

    Public Structure SP_DEVICE_INTERFACE_DETAIL_DATA
        Dim cbSize As Int32
        Dim DevicePath As String
    End Structure

    <DllImport("setupapi.dll", SetLastError:=True)> _
    Shared Function SetupDiEnumDeviceInterfaces _
    (ByVal DeviceInfoSet As IntPtr, _
    ByVal DeviceInfoData As IntPtr, _
    ByRef InterfaceClassGuid As System.Guid, _
    ByVal MemberIndex As Int32, _
    ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA) _
    As Boolean
    End Function
  
    <DllImport("setupapi.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Shared Function SetupDiGetDeviceInterfaceDetail _
    (ByVal DeviceInfoSet As IntPtr, _
    ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA, _
    ByVal DeviceInterfaceDetailData As IntPtr, _
    ByVal DeviceInterfaceDetailDataSize As Int32, _
    ByRef RequiredSize As Int32, _
    ByVal DeviceInfoData As IntPtr) _
    As Boolean
    End Function
    <DllImport("setupapi.dll", SetLastError:=True)> _
Shared Function SetupDiDestroyDeviceInfoList _
(ByVal DeviceInfoSet As IntPtr) _
As Int32
    End Function
   
    <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
    Shared Function CreateFile _
    (ByVal lpFileName As String, _
    ByVal dwDesiredAccess As UInt32, _
    ByVal dwShareMode As Int32, _
    ByVal lpSecurityAttributes As IntPtr, _
    ByVal dwCreationDisposition As Int32, _
    ByVal dwFlagsAndAttributes As Int32, _
    ByVal hTemplateFile As Int32) _
    As SafeFileHandle
    End Function

    <DllImport("kernel32.dll", SetLastError:=True)> _
    Shared Function WriteFile _
    (ByVal hFile As SafeFileHandle, _
    ByVal lpBuffer() As Byte, _
    ByVal nNumberOfBytesToWrite As Int32, _
    ByRef lpNumberOfBytesWritten As Int32, _
    ByVal lpOverlapped As IntPtr) _
    As Boolean
    End Function
    <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
 Shared Function GetOverlappedResult _
 (ByVal hFile As SafeFileHandle, _
 ByVal lpOverlapped As IntPtr, _
 ByRef lpNumberOfBytesTransferred As Int32, _
 ByVal bWait As Boolean) _
 As Boolean
    End Function
    <DllImport("kernel32.dll", SetLastError:=True)> _
    Shared Function ReadFile _
    (ByVal hFile As SafeFileHandle, _
    ByVal lpBuffer As IntPtr, _
    ByVal nNumberOfBytesToRead As Int32, _
    ByRef lpNumberOfBytesRead As Int32, _
    ByVal lpOverlapped As IntPtr) _
    As Boolean
    End Function

    Public Function find_device() As String
        Dim guid As String = "{4f919102-4adf-11d5-882d-00b0d02fe381}"
        Dim myGuid As New System.Guid(guid)
        Dim DIGCF_PRESENT As Int32 = 2
        Dim DIGCF_DEVICEINTERFACE As Int32 = &H10
        Dim deviceInfoSet As IntPtr
        Dim memberIndex As Int32 = 0
        Dim MyDeviceInterfaceData As SP_DEVICE_INTERFACE_DATA
        Dim success As Boolean
        Dim bufferSize As Int32
        Dim detailDataBuffer As IntPtr


        deviceInfoSet = SetupDiGetClassDevs _
        (myGuid, _
        IntPtr.Zero, _
        IntPtr.Zero, _
        DIGCF_PRESENT Or DIGCF_DEVICEINTERFACE)


        MyDeviceInterfaceData.cbSize = Marshal.SizeOf(MyDeviceInterfaceData)
        success = SetupDiEnumDeviceInterfaces _
        (deviceInfoSet, _
        IntPtr.Zero, _
        myGuid, _
        memberIndex, _
        MyDeviceInterfaceData)


        success = SetupDiGetDeviceInterfaceDetail _
        (deviceInfoSet, _
        MyDeviceInterfaceData, _
        IntPtr.Zero, _
        0, _
        bufferSize, _
        IntPtr.Zero)

        detailDataBuffer = Marshal.AllocHGlobal(bufferSize)
        Marshal.WriteInt32 _
        (detailDataBuffer, _
        Convert.ToInt32(IIf((IntPtr.Size = 4), 4 + Marshal.SystemDefaultCharSize, 8)))

        success = SetupDiGetDeviceInterfaceDetail _
        (deviceInfoSet, _
        MyDeviceInterfaceData, _
        detailDataBuffer, _
        bufferSize, _
        bufferSize, _
        IntPtr.Zero)

        Dim devicePathName As String = ""
        Dim pDevicePathName As IntPtr = New IntPtr(detailDataBuffer.ToInt32 + 4)
        devicePathName = Marshal.PtrToStringAuto(pDevicePathName)
        Marshal.FreeHGlobal(detailDataBuffer)

        SetupDiDestroyDeviceInfoList(deviceInfoSet)

        Return devicePathName
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Clear()
        If Me.Button1.Text = "Scan" Then
            Dim devicePathName As String = find_device()
            deviceHandle = CreateFile _
            (devicePathName, _
            GENERIC_READ Or GENERIC_WRITE, _
             FILE_SHARE_READ, _
            IntPtr.Zero, _
            OPEN_EXISTING, _
            FILE_ATTRIBUTE_NORMAL, _
            0)

            If deviceHandle.IsInvalid = True Then
                ListBox1.Items.Add("Phone not detected :(")
                Me.Button2.Enabled = False
                Me.Button4.Enabled = False
                Me.ComboBox1.Enabled = False
            Else
                ListBox1.Items.Add("Phone detected! :)")
                Me.Button1.Enabled = False
                Me.Button2.Enabled = True
                Call Button2_Click(sender, e)
                Me.Button4.Enabled = True
                Me.ComboBox1.Enabled = True
                Me.Button1.Text = "Discon."
            End If
        Else
            Me.Button1.Text = "Scan"
            deviceHandle.Close()
            Me.ComboBox1.Enabled = False
            Me.Button4.Enabled = False
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim sw_version() As Byte = {&H1B, &H0, &H10, &HD1, &H0, _
                                  &H5, &H0, &H9, &H0, &H3, &H0}
        Dim imei() As Byte = {&H1B, &H0, &H10, &H1B, &H0, _
                                    &H8, &H0, &H6, &H23, &H0, &H41, &H0, &H0, &H0}

        ListBox1.Items.Add("")
        ListBox1.Items.Add("Sw.      : " & read_write_str(deviceHandle, sw_version, sw_version.Length))
        Thread.Sleep(100)
        ListBox1.Items.Add("IMEI     : " & read_write_str(deviceHandle, imei, imei.Length))
        Thread.Sleep(100)
        ListBox1.Items.Add("")
        Button1.Enabled = True
        Button2.Enabled = False
    End Sub

    Public Function read_write_str(ByVal devicehandle, ByVal command, ByVal commandlenght) As String
        Dim inputReportBuffer(100) As Byte
        unManagedBuffer = Marshal.AllocHGlobal(inputReportBuffer.Length)
        numberOfBytesRead = 0
        numberOfBytesWritten = 0

        success = WriteFile _
        (devicehandle, _
        command, _
        commandlenght, _
        numberOfBytesWritten, _
        IntPtr.Zero)
        Thread.Sleep(50)

        success = ReadFile _
           (devicehandle, _
            unManagedBuffer, _
            inputReportBuffer.Length, _
            numberOfBytesRead, _
            unManagedOverlapped)

        Marshal.Copy _
        (unManagedBuffer, inputReportBuffer, 0, numberOfBytesRead)

        ReDim Preserve inputReportBuffer(numberOfBytesRead - 1)

        Dim inputReportBuffer_element As Byte

        Dim rest As String = ""
        Dim n As Integer = 0


        For Each inputReportBuffer_element In inputReportBuffer
            If n > commandlenght - 1 Then
                Select Case inputReportBuffer_element

                    Case Is < &H20
                        rest = rest & " "
                    Case Is = &H20
                        rest = rest & " "
                    Case Is > &H20

                        rest = rest & Chr(Val("&h" & inputReportBuffer_element.ToString("X2")))
                End Select
            End If
            n += 1
        Next

        Return rest.Trim
    End Function
    Public Function SetMode(ByVal devicehandle, ByVal Mode) As String
        Dim inputReportBuffer(100) As Byte
        unManagedBuffer = Marshal.AllocHGlobal(inputReportBuffer.Length)
        numberOfBytesRead = 0
        numberOfBytesWritten = 0
        Dim pmsec() As Byte = {&H1B, &H0, &H10, &H15, &H0, &H6, &H0, &H6, &H0, &H1, &H1, &H0}
        Dim CmdNormal() As Byte = {&H1B, &H0, &H10, &H15, &H0, &H6, &H0, &H6, &H0, &H1, &H1, &H0}
        Dim CmdLocal() As Byte = {&H1B, &H0, &H10, &H15, &H0, &H6, &H0, &H6, &H0, &H1, &H5, &H0}
        Dim CmdTest() As Byte = {&H1B, &H0, &H10, &H15, &H0, &H6, &H0, &H6, &H0, &H1, &H4, &H0}
        Select Case Mode
            Case 0 'Normal Mode
                pmsec = CmdNormal
            Case 1 'Local Mode
                pmsec = CmdLocal
            Case 2 'Test mode
                pmsec = CmdTest
        End Select

        success = WriteFile _
        (devicehandle, _
        pmsec, _
        pmsec.Length, _
        numberOfBytesWritten, _
        IntPtr.Zero)
        Thread.Sleep(50)

        success = ReadFile _
           (devicehandle, _
            unManagedBuffer, _
            inputReportBuffer.Length, _
            numberOfBytesRead, _
            unManagedOverlapped)

        Marshal.Copy _
        (unManagedBuffer, inputReportBuffer, 0, numberOfBytesRead)

        ReDim Preserve inputReportBuffer(numberOfBytesRead - 1)

        Dim inputReportBuffer_element As Byte

        Dim rest As String = ""
        For Each inputReportBuffer_element In inputReportBuffer

            rest = rest & "" & inputReportBuffer_element.ToString("X2")
            
        Next
        If numberOfBytesRead <= 11 Then
            Return "Failed!"
            Exit Function
        End If
        rest = rest.Trim
        If rest = "1B1000150006063A00640000" Then
            Return "OK"
        Else
            Return "Failed!"
        End If
    End Function
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()
        End
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If deviceHandle.IsInvalid = False Then
            ListBox1.Items.Add("Setting " & ComboBox1.Text & "..." & SetMode(deviceHandle, ComboBox1.SelectedIndex))
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.SelectedIndex = 1
    End Sub

    
End Class
  Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eeprom reading KLImax Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 2 09-22-2011 15:55
read eeprom write eeprom, what do i need? jonthe Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 5 12-08-2010 06:24
SMS via system connector pasisoft Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 1 10-21-1999 11:05
Silly question!! Why is it impossible to read out the mastercode of Nokia phones???? MyKe Nokia Legacy Phones ( DCT-1 ,2 ,3 ,L ) 0 09-26-1999 14:31

 



All times are GMT +1. The time now is 07:53.



Powered by Searchlight © 2024 Axivo Inc.
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -
Page generated in 0.23393 seconds with 9 queries

SEO by vBSEO