Sign in to follow this  
Followers 0
mkm619

I need help with this script

1 post in this topic

#1 ·  Posted (edited)

hi all.

this script is supposed to start silkmod then write id and pw and continue to press enter but it freezes after it open silkmod.exe

also in managing exidting clients part it hides,minimize,show..etc the script interface instead of the client.

here's the code:-

Dim $hwnd, $sw=False
#include <GUIConstantsEx.au3>
#Include <GuiListView.au3>
$kernel32 = DllOpen('kernel32.dll')
$gui = GUICreate('SilkMod Client Manager', 435, 300, 193, 125, 0x100A0000)
$id = GUICtrlCreateCombo('write your ID here', 10, 25, 200)
$pw = GUICtrlCreateCombo('write your PW here', 220, 25, 200)
$go = GUICtrlCreateButton('Start SilkMod with autologin!', 320 / 2 - 85 / 2, 55, 200, 25)
$listview = GUICtrlCreateListView("Client Name", 8, 100, 250, 150, BitOR($LVS_SORTDESCENDING, $LVS_LIST, $LVS_SHOWSELALWAYS));The right way to have multiple styles is with BitOr()
$Button1 = GUICtrlCreateButton("Min", 272, 160, 75, 25)
$Button2 = GUICtrlCreateButton("Max", 352, 100, 75, 25)
$Button3 = GUICtrlCreateButton("Hide", 352, 220, 75, 25)
$Button4 = GUICtrlCreateButton("Show", 352, 160, 75, 25)
$Button5 = GUICtrlCreateButton("Exit", 272, 220, 75, 25)
$Button6 = GUICtrlCreateButton("Refresh", 272, 100, 72, 25)
GUICtrlCreateLabel("Start new client with autologin", 10, 1)
GUICtrlCreateLabel("Control existing clients", 10, 85)
_Refresh()
GUISetState(@SW_SHOW)

If FileExists('login info.ini') Then
    $logindata = IniReadSection('login info.ini', 'chars')
    For $i = 1 To $logindata[0][0]
        GUICtrlSetData($id, $logindata[$i][0])
        GUICtrlSetData($pw, $logindata[$i][1])
    Next
EndIf

while 1
        Switch GUIGetMsg()
            Case $go
                go()
            Case $id
                If FileExists('login info.ini') Then
                    $logindata = IniReadSection('login info.ini', 'chars')
                    For $i = 1 To $logindata[0][0]
                        If GUICtrlRead($id) = $logindata[$i][0] Then GUICtrlSetData($pw, $logindata[$i][1])
                    Next
                EndIf
        EndSwitch       
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
               Exit
            Case $Button5
               Exit
            Case $Button1
               _SetState(@SW_MINIMIZE)
            Case $Button2
               _SetState(@SW_MAXIMIZE)
            Case $Button3
                _SetState(@SW_HIDE)
            Case $Button4
                _SetState(@SW_SHOW)
            Case $Button6
                _Refresh()
            EndSwitch
WEnd

Func go()
    $_id = GUICtrlRead($id)
    $_pw = GUICtrlRead($pw)
    $pid = Run(@ScriptDir & '\SilkMod.exe ')
    ;open memory handle
    $mid = memopen($pid)
    ;mc
        ;SWSRO

        If memread($mid, 0x633180, 'byte[2]') = '0x7547' Then
            memwrite($mid, 0x633180, 'EB')
            $sw=True
        EndIf
        If $sw=True Then
            $base = 0xA9EE44
            $name = 0xA9DB98
            $logged = $name-0x2D14
        EndIf

        Do
            $size = WinGetClientSize($hwnd)
            If Not IsArray($size) Then Exit
            Sleep(10)
        Until $size[0] = 400
        Do
            $nsize = WinGetClientSize($hwnd)
            If Not IsArray($nsize) Then Exit
            Sleep(10)
        Until $nsize[0] <> $size[0]
        
            Sleep(2000)
        If $_id <> 'ID'  And $_id <> '' Then
            DllCall('User32.dll', 'int', 'PostMessageA', 'hwnd', ControlGetHandle($hwnd, '', ''), 'int', 0x100, 'int', 0x09, 'int', 0)
            DllCall('User32.dll', 'int', 'PostMessageA', 'hwnd', ControlGetHandle($hwnd, '', ''), 'int', 0x100, 'int', 0x09, 'int', 0)
            PostText($hwnd, $_id)
            DllCall('User32.dll', 'int', 'PostMessageA', 'hwnd', ControlGetHandle($hwnd, '', ''), 'int', 0x100, 'int', 0x09, 'int', 0)
            PostText($hwnd, $_pw)
            Sleep(500)
            Do
                enter($hwnd)
                Sleep(1000)
            Until memread($mid, $logged) = 1 Or Not WinExists($hwnd) Or Not ProcessExists($pid)
        EndIf
        Do
            $base_val = memread($mid, $base)
            Sleep(1000)
            ConsoleWrite($base_val&@CRLF)
        Until $base_val <> 0 Or Not WinExists($hwnd) Or Not ProcessExists($pid)
        WinSetTitle($hwnd, '', memread($mid, $name, 'char[12]'))
    ;close handle
    memclose($mid)
    DllClose($kernel32)
EndFunc   ;==>go

Func enter($hwnd)
    DllCall('User32.dll', 'int', 'PostMessage', 'hwnd', ControlGetHandle($hwnd, '', ''), 'int', 0x100, 'int', 0x0D, 'int', 0)
EndFunc   ;==>enter

Func memopen($pid)
    Local $mid = DllCall($kernel32, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 1, 'int', $pid)
    Return $mid[0]
EndFunc   ;==>memopen

Func memread($mid, $adress, $type = 'dword')
    Local $struct = DllStructCreate($type)
    DllCall($kernel32, 'int', 'ReadProcessMemory', 'int', $mid, 'int', $adress, 'ptr', DllStructGetPtr($struct), 'int', DllStructGetSize($struct), 'int', '')
    Return DllStructGetData($struct, 1)
EndFunc   ;==>memread

Func memwrite($mid, $adress, $hex)
    Local $struct = DllStructCreate('byte[' & BinaryLen('0x' & $hex) & ']')
    For $i = DllStructGetSize($struct) To 1 Step - 1
        DllStructSetData($struct, 1, BinaryMid('0x' & $hex, $i, 1), $i)
    Next
    Local $x = DllCall($kernel32, 'int', 'VirtualProtectEx', 'int', $mid, 'ptr', $adress, 'int', DllStructGetSize($struct), 'dword', 0x40, 'dword*', 0)
    DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $mid, 'int', $adress, 'ptr', DllStructGetPtr($struct), 'int', DllStructGetSize($struct), 'int', 0)
    DllCall($kernel32, 'int', 'VirtualProtectEx', 'int', $mid, 'ptr', $adress, 'int', DllStructGetSize($struct), 'dword', $x[5], 'dword*', 0)
EndFunc   ;==>memwrite

Func memclose($mid)
    DllCall($kernel32, 'int', 'CloseHandle', 'int', $mid)
EndFunc   ;==>memclose

Func PostText($hwnd, $string)
    $key = StringSplit(StringUpper($string), '')
    For $i = 1 To $key[0]
        DllCall('User32.dll', 'int', 'PostMessage', 'hwnd', ControlGetHandle($hwnd, '', ''), 'int', 0x100, 'int', AscW($key[$i]), 'int', 0)
    Next
EndFunc   ;==>PostText


Func _SetState($State)
    $Client = WinList("Class:CLIENT")
    $Array =_GUICtrlListView_GetSelectedIndices($listview)
        WinSetState($Client[$Array][1], "", $State)
EndFunc

Func _Refresh()
    _GUICtrlListView_BeginUpdate($listview)
    _GUICtrlListView_DeleteAllItems($listview)
    $Client = WinList("[CLASS:CLIENT]")
    If $Client[0][0] > 0 Then
        For $X = 1 To $Client[0][0]
            GUICtrlCreateListViewItem($Client[$X][0], $listview)
        Next
    Else
        GUICtrlCreateListViewItem("No Clients Found", $listview)
    EndIf
    _GUICtrlListView_EndUpdate($listview)
EndFunc  ;==>_Refresh

PS:- SilkMod is a silkroad online loader

-I know that game's bot are not allowed in this forum but this is not a bot or a cheat it's just a useful tool that helps players login the game and control the game client

Edited by mkm619

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0