├── .gitattributes ├── .gitignore ├── AddChangeCmdLine.dlg ├── AutoCmdLine-readme.txt ├── AutoCmdLine.Asm ├── AutoCmdLine.Def ├── AutoCmdLine.Inc ├── AutoCmdLine.rap ├── AutoCmdLine.rc ├── AutoCmdLine.xml ├── AutoCmdLineIni.asm ├── README.md ├── images ├── AutoCmdLine.ico └── AutoCmdLine.png ├── release ├── AutoCmdLine-readme.txt └── AutoCmdLine.dp64 └── res ├── AddChangeCmdLineDlg.rc ├── AutoCmdLineRes.rc └── AutoCmdLineVer.rc /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=crlf 2 | *.exe binary 3 | *.dll binary 4 | *.zip binary 5 | *.obj binary 6 | *.res binary 7 | *.lib binary 8 | *.dlg binary 9 | *.mnu binary 10 | *.ttf binary 11 | *.ico binary 12 | *.bmp binary 13 | *.png binary 14 | *.jpg binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bak/ 2 | *.undo 3 | *.obj 4 | *.pdb 5 | *.ilk 6 | *.exp 7 | Help/ 8 | template/ 9 | downloads/ 10 | screenshots/ 11 | wiki/ 12 | packagedownloads.bat 13 | -------------------------------------------------------------------------------- /AddChangeCmdLine.dlg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrfearless/AutoCmdLine-Plugin-x64/07784023eb1f2754c7f2bcdc8470935be2c36c46/AddChangeCmdLine.dlg -------------------------------------------------------------------------------- /AutoCmdLine-readme.txt: -------------------------------------------------------------------------------- 1 | ;===================================================================================== 2 | ; 3 | ; AutoCmdLine-readme.txt 4 | ; 5 | ; v1.0.0.4 - Last updated: 09/08/2016 6 | ; 7 | ;------------------------------------------------------------------------------------- 8 | 9 | About 10 | ----- 11 | 12 | AutoCmdLine Plugin (x64) For x64dbg (64bit plugin) 13 | by fearless - www.LetTheLight.in 14 | 15 | Created with the x64dbg Plugin SDK For x64 Assembler 16 | https://github.com/mrfearless/x64dbg-Plugin-SDK-For-x64-Assembler 17 | 18 | 19 | Overview 20 | -------- 21 | 22 | A plugin to remember the command line and load it up automatically 23 | 24 | 25 | Features 26 | -------- 27 | 28 | - Add and/or change command line 29 | - Remember command line 30 | - Automatically set command line 31 | 32 | 33 | Notes 34 | ----- 35 | 36 | AutoCmdLine takes the modulename, the full filepath of the program that is loaded and 37 | being debugged and creates an MD5 hash from this value. 38 | It searches in the plugins\AutoCmdLine.ini file for a matching profile section name 39 | and loads up the saved command line if it was set to 'remember' it. 40 | 41 | 'remember' perhaps should be named auto-load as it will auto load this command line 42 | the next time the same module is being debugged. 43 | 44 | Arguments on the command line should be wrapped with double quotes "" 45 | and you should specify the fullpath for any arguments that require it. 46 | 47 | This is to ensure compatability with windows and how it handles arguments and also 48 | with the way x64dbg sets the cmdline. 49 | 50 | - 09/08/2016 Added fix for full command line to be set, previously only saved portion was 51 | - 26/06/2016 Updated x64dbg SDK for masm to version 1.0.0.3 and recompiled plugin. 52 | - 01/03/2016 Updated x64dbg SDK for masm to version 1.0.0.2 and recompiled plugin. 53 | - Added function AutoCmdLineLoadMenuIcon to load png resource image as raw bytes 54 | - Added menu icon for plugin (uses _plugin_menuseticon) -------------------------------------------------------------------------------- /AutoCmdLine.Asm: -------------------------------------------------------------------------------- 1 | ;===================================================================================== 2 | ; x64dbg plugin SDK for Masm - fearless 2015 3 | ; 4 | ; AutoCmdLine.asm 5 | ; 6 | ;------------------------------------------------------------------------------------- 7 | .686 8 | .MMX 9 | .XMM 10 | .x64 11 | 12 | option casemap : none 13 | option win64 : 11 14 | option frame : auto 15 | option stackbase : rsp 16 | 17 | _WIN64 EQU 1 18 | WINVER equ 0501h 19 | 20 | Include x64dbgpluginsdk.inc ; Main x64dbg Plugin SDK for your program, and prototypes for the main exports 21 | 22 | Include AutoCmdLine.inc ; plugin's include file 23 | Include AutoCmdLineIni.asm 24 | 25 | pluginit PROTO :QWORD ; Required prototype and export for x64dbg plugin SDK 26 | plugstop PROTO ; Required prototype and export for x64dbg plugin SDK 27 | plugsetup PROTO :QWORD ; Required prototype and export for x64dbg plugin SDK 28 | ;===================================================================================== 29 | 30 | 31 | .CONST 32 | PLUGIN_VERSION EQU 1 33 | 34 | .DATA 35 | align 01 36 | PLUGIN_NAME DB "AutoCmdLine",0 37 | 38 | .DATA? 39 | ;------------------------------------------------------------------------------------- 40 | ; GLOBAL Plugin SDK variables 41 | ;------------------------------------------------------------------------------------- 42 | align 08 43 | 44 | PUBLIC pluginHandle 45 | PUBLIC hwndDlg 46 | PUBLIC hMenu 47 | PUBLIC hMenuDisasm 48 | PUBLIC hMenuDump 49 | PUBLIC hMenuStack 50 | 51 | pluginHandle DD ? 52 | hwndDlg DQ ? 53 | hMenu DD ? 54 | hMenuDisasm DD ? 55 | hMenuDump DD ? 56 | hMenuStack DD ? 57 | ;------------------------------------------------------------------------------------- 58 | 59 | 60 | .CODE 61 | 62 | ;===================================================================================== 63 | ; Main entry function for a DLL file - required. 64 | ;------------------------------------------------------------------------------------- 65 | DllMain PROC hInst:HINSTANCE, fdwReason:DWORD, lpvReserved:LPVOID 66 | .IF fdwReason == DLL_PROCESS_ATTACH 67 | mov rax, hInst 68 | mov hInstance, rax 69 | .ENDIF 70 | mov rax,TRUE 71 | ret 72 | DllMain Endp 73 | 74 | 75 | ;===================================================================================== 76 | ; pluginit - Called by debugger when plugin.dp64 is loaded - needs to be EXPORTED 77 | ; 78 | ; Arguments: initStruct - a pointer to a PLUG_INITSTRUCT structure 79 | ; 80 | ; Notes: you must fill in the pluginVersion, sdkVersion and pluginName members. 81 | ; The pluginHandle is obtained from the same structure - it may be needed in 82 | ; other function calls. 83 | ; 84 | ; you can call your own setup routine from within this function to setup 85 | ; menus and commands, and pass the initStruct parameter to this function. 86 | ; 87 | ;------------------------------------------------------------------------------------- 88 | pluginit PROC FRAME USES RBX initStruct:QWORD 89 | mov rbx, initStruct 90 | 91 | ; Fill in required information of initStruct, which is a pointer to a PLUG_INITSTRUCT structure 92 | mov eax, PLUGIN_VERSION 93 | mov [rbx].PLUG_INITSTRUCT.pluginVersion, eax 94 | mov eax, PLUG_SDKVERSION 95 | mov [rbx].PLUG_INITSTRUCT.sdkVersion, eax 96 | Invoke lstrcpy, Addr [rbx].PLUG_INITSTRUCT.pluginName, Addr PLUGIN_NAME 97 | 98 | mov rbx, initStruct 99 | mov eax, [rbx].PLUG_INITSTRUCT.pluginHandle 100 | mov pluginHandle, eax 101 | 102 | ; Do any other initialization here 103 | 104 | ; Construct plugin's .ini file from module filename 105 | Invoke GetModuleFileName, hInstance, Addr AutoCmdLineIni, SIZEOF AutoCmdLineIni 106 | Invoke lstrlen, Addr AutoCmdLineIni 107 | lea rbx, AutoCmdLineIni 108 | add rbx, rax 109 | sub rbx, 4 ; move back past 'dp32' extention 110 | mov byte ptr [rbx], 0 ; null so we can use lstrcat 111 | Invoke lstrcat, rbx, Addr szIni ; add 'ini' to end of string instead 112 | 113 | Invoke LoadIcon, hInstance, ICO_AUTOCMDLINE 114 | mov hIcoAutoCmdLine, eax 115 | 116 | mov rax, TRUE 117 | ret 118 | pluginit endp 119 | 120 | 121 | ;===================================================================================== 122 | ; plugstop - Called by debugger when the plugin.dp64 is unloaded - needs to be EXPORTED 123 | ; 124 | ; Arguments: none 125 | ; 126 | ; Notes: perform cleanup operations here, clearing menus and other housekeeping 127 | ; 128 | ;------------------------------------------------------------------------------------- 129 | plugstop PROC FRAME 130 | 131 | ; remove any menus, unregister any callbacks etc 132 | Invoke _plugin_menuclear, hMenu 133 | Invoke GuiAddLogMessage, Addr szPluginUnloaded 134 | 135 | mov eax, TRUE 136 | ret 137 | plugstop endp 138 | 139 | 140 | ;===================================================================================== 141 | ; plugsetup - Called by debugger to initialize your plugins setup - needs to be EXPORTED 142 | ; 143 | ; Arguments: setupStruct - a pointer to a PLUG_SETUPSTRUCT structure 144 | ; 145 | ; Notes: setupStruct contains useful handles for use within x64dbg, mainly Qt 146 | ; menu handles (which are not supported with win32 api) and the main window 147 | ; handle with this information you can add your own menus and menu items 148 | ; to an existing menu, or one of the predefined supported right click 149 | ; context menus: hMenuDisam, hMenuDump & hMenuStack 150 | ; 151 | ; plugsetup is called after pluginit. 152 | ;------------------------------------------------------------------------------------- 153 | plugsetup PROC FRAME USES RBX setupStruct:QWORD 154 | LOCAL hIconData:ICONDATA 155 | 156 | mov rbx, setupStruct 157 | 158 | ; Extract handles from setupStruct which is a pointer to a PLUG_SETUPSTRUCT structure 159 | mov rax, [rbx].PLUG_SETUPSTRUCT.hwndDlg 160 | mov hwndDlg, rax 161 | mov eax, [rbx].PLUG_SETUPSTRUCT.hMenu 162 | mov hMenu, eax 163 | mov eax, [rbx].PLUG_SETUPSTRUCT.hMenuDisasm 164 | mov hMenuDisasm, eax 165 | mov eax, [rbx].PLUG_SETUPSTRUCT.hMenuDump 166 | mov hMenuDump, eax 167 | mov eax, [rbx].PLUG_SETUPSTRUCT.hMenuStack 168 | mov hMenuStack, eax 169 | 170 | ; Do any setup here: add menus, menu items, callback and commands etc 171 | Invoke GuiAddLogMessage, Addr szAutoCmdLineInfo ;szPluginLoaded 172 | Invoke _plugin_menuaddentry, hMenu, MENU_PLUGIN1, Addr szMenuPlugin1 173 | 174 | Invoke AutoCmdLineLoadMenuIcon, IMG_AUTOCMDLINE, Addr hIconData 175 | .IF eax == TRUE 176 | Invoke _plugin_menuseticon, hMenu, Addr hIconData 177 | Invoke _plugin_menuentryseticon, pluginHandle, MENU_PLUGIN1, Addr hIconData 178 | .ENDIF 179 | 180 | Invoke GuiGetWindowHandle 181 | mov hwndDlg, rax 182 | 183 | ret 184 | plugsetup endp 185 | 186 | 187 | ;===================================================================================== 188 | ; CBMENUENTRY - Called by debugger when a menu item is clicked - needs to be EXPORTED 189 | ; 190 | ; Arguments: cbType 191 | ; cbInfo - a pointer to a PLUG_CB_MENUENTRY structure. The hEntry contains 192 | ; the resource id of menu item identifiers 193 | ; 194 | ; Notes: hEntry can be used to determine if the user has clicked on your plugins 195 | ; menu item(s) and to do something in response to it. 196 | ; Needs to be PROC C type procedure call to be compatible with debugger 197 | ;------------------------------------------------------------------------------------- 198 | CBMENUENTRY PROC FRAME USES RBX cbType:QWORD, cbInfo:QWORD 199 | mov rbx, cbInfo 200 | xor rax, rax 201 | mov eax, [rbx].PLUG_CB_MENUENTRY.hEntry 202 | 203 | .IF eax == MENU_PLUGIN1 204 | Invoke DbgIsDebugging 205 | .IF rax == FALSE 206 | Invoke GuiAddStatusBarMessage, Addr szDebuggingRequired 207 | Invoke GuiAddLogMessage, Addr szDebuggingRequired 208 | ret 209 | .ELSE 210 | ; todo add check for not in ntdll.dll 211 | 212 | Invoke DialogBoxParam, hInstance, IDD_AddCmdLine, hwndDlg, OFFSET AddCmdLineDlgProc, NULL 213 | .ENDIF 214 | .ENDIF 215 | 216 | ret 217 | 218 | CBMENUENTRY endp 219 | 220 | 221 | ;===================================================================================== 222 | ; CBINITDEBUG - Called by debugger when a program is debugged - needs to be EXPORTED 223 | ; 224 | ; Arguments: cbType 225 | ; cbInfo - a pointer to a PLUG_CB_INITDEBUG structure. 226 | ; The szFileName item contains name of file being debugged. 227 | ; 228 | ; Notes: 229 | ; 230 | ; Needs to be PROC C type procedure call to be compatible with debugger 231 | ;------------------------------------------------------------------------------------- 232 | CBINITDEBUG PROC FRAME USES RBX cbType:QWORD, cbInfo:QWORD 233 | LOCAL lpszFilename:QWORD 234 | 235 | Invoke RtlZeroMemory, Addr DebugFilenameMD5, SIZEOF DebugFilenameMD5 236 | 237 | mov rbx, cbInfo 238 | mov rax, [rbx] 239 | mov DebugFilename, rax 240 | mov lpszFilename, rax 241 | 242 | ; create hash of module filename and path to check in our .ini file for previous cmd line 243 | Invoke AutoCmdLineCreateHash, lpszFilename, Addr DebugFilenameMD5 244 | 245 | ; for debugging to view md5 hash 246 | ;Invoke lstrcpy, Addr szLogMsg, Addr szCBINITDEBUG 247 | ;Invoke lstrcat, Addr szLogMsg, Addr DebugFilenameMD5 248 | ;Invoke lstrcat, Addr szLogMsg, Addr szCRLF 249 | ;Invoke GuiAddLogMessage, Addr szLogMsg 250 | 251 | mov rax, TRUE 252 | ret 253 | 254 | CBINITDEBUG endp 255 | 256 | 257 | ;===================================================================================== 258 | ; CBSYSTEMBREAKPOINT - Called by debugger at system breakpoint - needs to be EXPORTED 259 | ; 260 | ; Arguments: cbType 261 | ; cbInfo - reserved 262 | ; 263 | ; 264 | ; Notes: 265 | ; 266 | ; Needs to be PROC C type procedure call to be compatible with debugger 267 | ;------------------------------------------------------------------------------------- 268 | CBSYSTEMBREAKPOINT PROC FRAME cbType:QWORD, cbInfo:QWORD 269 | Invoke GuiSelectionGet, GUI_DISASSEMBLY, Addr sel 270 | _DbgFunctions ModPathFromAddr, sel.start, Addr szModuleFilename, MAX_PATH 271 | 272 | Invoke IniGetModuleCmdLine, Addr szModuleFilename, Addr szNewCommandLine, Addr dqRemember 273 | .IF rax == TRUE ; found it 274 | .IF dqRemember == 1 ; we fetch saved command line 275 | ; add entry into log to say cmd line has been changed 276 | Invoke RtlZeroMemory, Addr szLogMsg, SIZEOF szLogMsg 277 | Invoke lstrcpy, Addr szLogMsg, Addr szAutoCmdLineAutoChange 278 | Invoke lstrcat, Addr szLogMsg, Addr szNewCommandLine 279 | Invoke lstrcat, Addr szLogMsg, Addr szCRLF 280 | Invoke GuiAddLogMessage, Addr szLogMsg 281 | 282 | ; do the call to setcmdline 283 | Invoke lstrcpy, Addr szCommandLine, Addr szQuote 284 | Invoke lstrcat, Addr szCommandLine, DebugFilename 285 | Invoke lstrcat, Addr szCommandLine, Addr szQuote 286 | Invoke lstrcat, Addr szCommandLine, Addr szSpace 287 | Invoke lstrcat, Addr szCommandLine, Addr szNewCommandLine 288 | _DbgFunctions SetCmdline, Addr szCommandLine ;szNewCommandLine 289 | Invoke DbgCmdExec, Addr szGetCmdLine 290 | 291 | ;Invoke lstrcat, Addr szNewCommandLine, Addr szCRLF 292 | ;_DbgFunctions SetCmdline, Addr szNewCommandLine 293 | .ENDIF 294 | .ENDIF 295 | 296 | mov rax, TRUE 297 | ret 298 | CBSYSTEMBREAKPOINT ENDP 299 | 300 | 301 | ;===================================================================================== 302 | ; AddCmdLineDlgProc Dialog Procedure 303 | ;------------------------------------------------------------------------------------- 304 | AddCmdLineDlgProc PROC FRAME hWin:HWND, iMsg:UINT, wParam:WPARAM, lParam:LPARAM 305 | LOCAL dqNewRemember:QWORD 306 | 307 | 308 | mov eax, iMsg 309 | .IF eax == WM_INITDIALOG 310 | ; Any initialization here 311 | Invoke SendMessage, hWin, WM_SETICON, ICON_SMALL, hIcoAutoCmdLine 312 | ; Get some information to set in dialogbox textboxes and our checkbox 313 | ;Invoke GuiSelectionGet, GUI_DISASSEMBLY, Addr sel 314 | ;_DbgFunctions ModPathFromAddr, sel.start, Addr szModuleFilename, MAX_PATH 315 | Invoke SetDlgItemText, hWin, IDC_TxtAddCmdLineModuleFilename, DebugFilename ;szModuleFilename 316 | 317 | ; Search our ini file for a module that matches (using md5 hash of the full path name of file) 318 | Invoke IniGetModuleCmdLine, DebugFilename, Addr szCommandLine, Addr dqRemember ; szModuleFilename 319 | .IF eax == FALSE ; we didnt find it in our ini file, so fetch current command line 320 | ; ok, so we just get the default cmdline instead and present that to our user. 321 | mov eax, 1024d 322 | mov dwCmdLineSize, eax 323 | _DbgFunctions GetCmdline, Addr szCommandLine, Addr dwCmdLineSize 324 | Invoke SendDlgItemMessage, hWin, IDC_ChkAddCmdLineRemember, BM_SETCHECK, BST_UNCHECKED, 0 325 | 326 | .ELSE ; we did find it 327 | .IF dqRemember == 0 328 | Invoke SendDlgItemMessage, hWin, IDC_ChkAddCmdLineRemember, BM_SETCHECK, BST_UNCHECKED, 0 329 | .ELSE 330 | Invoke SendDlgItemMessage, hWin, IDC_ChkAddCmdLineRemember, BM_SETCHECK, BST_CHECKED, 0 331 | .ENDIF 332 | .ENDIF 333 | Invoke SetDlgItemText, hWin, IDC_TxtAddCmdLineCommandLine, Addr szCommandLine 334 | 335 | .ELSEIF eax == WM_CLOSE 336 | Invoke EndDialog, hWin, NULL 337 | 338 | .ELSEIF eax == WM_COMMAND 339 | mov rax, wParam 340 | and rax, 0FFFFh 341 | .IF eax == IDC_BtnAddCmdLineOK 342 | 343 | ; get text from command line textbox and get checkbox option 344 | Invoke RtlZeroMemory, Addr szNewCommandLine, SIZEOF szNewCommandLine 345 | Invoke GetDlgItemText, hWin, IDC_TxtAddCmdLineCommandLine, Addr szNewCommandLine, SIZEOF szNewCommandLine 346 | Invoke SendDlgItemMessage, hWin, IDC_ChkAddCmdLineRemember, BM_GETCHECK, 0, 0 347 | .IF eax == BST_CHECKED 348 | mov dqNewRemember, 1 349 | .ELSE 350 | mov dqNewRemember, 0 351 | .ENDIF 352 | 353 | ; save info to our ini file 354 | Invoke IniSetModuleCmdLine, DebugFilename, Addr szNewCommandLine, dqNewRemember ;szModuleFilename 355 | 356 | .IF dqRemember == 0 && dqNewRemember == 1 ; we are now set to remember so log msg reflects this 357 | Invoke RtlZeroMemory, Addr szLogMsg, SIZEOF szLogMsg 358 | Invoke lstrcpy, Addr szLogMsg, Addr szAutoCmdLineRemember 359 | Invoke lstrcat, Addr szLogMsg, Addr szNewCommandLine 360 | Invoke lstrcat, Addr szLogMsg, Addr szCRLF 361 | Invoke GuiAddLogMessage, Addr szLogMsg 362 | 363 | .ELSEIF dqRemember == 1 && dqNewRemember == 0 ; set to forget it 364 | Invoke RtlZeroMemory, Addr szLogMsg, SIZEOF szLogMsg 365 | Invoke lstrcpy, Addr szLogMsg, Addr szAutoCmdLineForgotten 366 | Invoke lstrcat, Addr szLogMsg, Addr szQ 367 | Invoke lstrcat, Addr szLogMsg, Addr szCRLF 368 | Invoke GuiAddLogMessage, Addr szLogMsg 369 | .ELSE 370 | ; otherwise we just changed command line 371 | Invoke RtlZeroMemory, Addr szLogMsg, SIZEOF szLogMsg 372 | Invoke lstrcpy, Addr szLogMsg, Addr szAutoCmdLineManualChange 373 | Invoke lstrcat, Addr szLogMsg, Addr szNewCommandLine 374 | Invoke lstrcat, Addr szLogMsg, Addr szCRLF 375 | Invoke GuiAddLogMessage, Addr szLogMsg 376 | .ENDIF 377 | 378 | ; do the call to setcmdline 379 | Invoke lstrcat, Addr szNewCommandLine, Addr szCRLF 380 | _DbgFunctions SetCmdline, Addr szNewCommandLine 381 | 382 | Invoke SendMessage, hWin, WM_CLOSE, NULL, NULL 383 | 384 | .ELSEIF eax == IDC_BtnAddCmdLineCancel 385 | Invoke SendMessage, hWin, WM_CLOSE, NULL, NULL 386 | 387 | .ENDIF 388 | .ELSE 389 | mov rax, FALSE 390 | ret 391 | .ENDIF 392 | mov rax, TRUE 393 | ret 394 | AddCmdLineDlgProc endp 395 | 396 | 397 | ;===================================================================================== 398 | ; AutoCmdLineCreateHash - Hash a string 399 | ;------------------------------------------------------------------------------------- 400 | AutoCmdLineCreateHash PROC FRAME USES RBX StringToHash:QWORD, HashedString:QWORD 401 | LOCAL hProv:HCRYPTPROV 402 | LOCAL hHash:HCRYPTHASH 403 | LOCAL pbHash:QWORD 404 | LOCAL dwHashLen:DWORD 405 | LOCAL dwCount:DWORD 406 | LOCAL lenStringToHash:DWORD 407 | LOCAL pTempHashString:QWORD 408 | LOCAL pcchString:DWORD 409 | 410 | Invoke lstrlen, StringToHash 411 | mov lenStringToHash, eax 412 | 413 | 414 | Invoke CryptAcquireContext, Addr hProv, NULL, NULL, PROV_RSA_FULL, 0; CRYPT_SILENT 415 | .IF rax != FALSE 416 | Invoke CryptCreateHash, hProv, CALG_MD5, 0, 0, Addr hHash 417 | .IF rax != FALSE 418 | Invoke CryptHashData, hHash, StringToHash, lenStringToHash, 0 419 | .IF rax != FALSE 420 | mov dwCount, 4d 421 | Invoke CryptGetHashParam, hHash, HP_HASHSIZE, Addr dwHashLen, Addr dwCount, 0 422 | .IF rax != FALSE 423 | Invoke GlobalAlloc, GMEM_FIXED+GMEM_ZEROINIT, dwHashLen 424 | .IF rax != NULL 425 | mov pTempHashString, rax 426 | 427 | Invoke CryptGetHashParam, hHash, HP_HASHVAL, pTempHashString, Addr dwHashLen, 0 428 | .IF rax != FALSE 429 | 430 | Invoke CryptBinaryToString, pTempHashString, dwHashLen, CRYPT_STRING_HEXRAW + CRYPT_STRING_NOCRLF, HashedString, Addr pcchString 431 | 432 | ;Invoke MessageBox, hwndDlg, StringToHash, pTempHashString, MB_OK 433 | ;Invoke lstrcpyn, HashedString, pTempHashString, dwHashLen 434 | 435 | .IF dwHashLen == 0 436 | ; Invoke GuiAddLogMessage, Addr szZeroLengthHash 437 | .ENDIF 438 | 439 | ;Invoke lstrcpy, Addr szLogMsg, Addr szCreateHashSuccess 440 | ;Invoke lstrcat, Addr szLogMsg, HashedString 441 | ;Invoke lstrcat, Addr szLogMsg, Addr szCRLF 442 | ;Invoke GuiAddLogMessage, Addr szLogMsg 443 | 444 | 445 | Invoke GlobalFree, pTempHashString 446 | Invoke CryptDestroyHash, hHash 447 | Invoke CryptReleaseContext, hProv, 0 448 | 449 | mov rax, TRUE 450 | ret 451 | .ELSE 452 | ;Invoke GuiAddLogMessage, Addr szErrorCryptGetHashParamVal 453 | .ENDIF 454 | .ELSE 455 | ;Invoke GuiAddLogMessage, Addr szErrorGlobalAlloc 456 | .ENDIF 457 | .ELSE 458 | ;Invoke GuiAddLogMessage, Addr szErrorCryptGetHashParamSize 459 | .ENDIF 460 | .ELSE 461 | ;Invoke GuiAddLogMessage, Addr szErrorCryptHashData 462 | .ENDIF 463 | .ELSE 464 | ;Invoke GuiAddLogMessage, Addr szErrorCryptCreateHash 465 | .ENDIF 466 | .ELSE 467 | ;Invoke GuiAddLogMessage, Addr szErrorCryptAcquireContext 468 | .ENDIF 469 | mov rax, FALSE 470 | ret 471 | 472 | AutoCmdLineCreateHash endp 473 | 474 | 475 | ;===================================================================================== 476 | ; AutoCmdLineLoadMenuIcon - Loads RT_RCDATA png resource and assigns it to ICONDATA 477 | ; Returns TRUE in eax if succesful or FALSE otherwise. 478 | ;------------------------------------------------------------------------------------- 479 | AutoCmdLineLoadMenuIcon PROC FRAME USES RBX dqImageResourceID:QWORD, lpIconData:QWORD 480 | LOCAL hRes:QWORD 481 | 482 | ; Load image for our menu item 483 | Invoke FindResource, hInstance, dqImageResourceID, RT_RCDATA ; load png image as raw data 484 | .IF eax != NULL 485 | mov hRes, rax 486 | Invoke SizeofResource, hInstance, hRes 487 | .IF rax != 0 488 | mov rbx, lpIconData 489 | mov [rbx].ICONDATA.size_, rax 490 | Invoke LoadResource, hInstance, hRes 491 | .IF rax != NULL 492 | Invoke LockResource, rax 493 | .IF rax != NULL 494 | mov rbx, lpIconData 495 | mov [rbx].ICONDATA.data, rax 496 | mov rax, TRUE 497 | .ELSE 498 | ;PrintText 'Failed to lock resource' 499 | mov rax, FALSE 500 | .ENDIF 501 | .ELSE 502 | ;PrintText 'Failed to load resource' 503 | mov rax, FALSE 504 | .ENDIF 505 | .ELSE 506 | ;PrintText 'Failed to get resource size' 507 | mov rax, FALSE 508 | .ENDIF 509 | .ELSE 510 | ;PrintText 'Failed to find resource' 511 | mov rax, FALSE 512 | .ENDIF 513 | ret 514 | 515 | AutoCmdLineLoadMenuIcon ENDP 516 | 517 | 518 | END DllMain 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | -------------------------------------------------------------------------------- /AutoCmdLine.Def: -------------------------------------------------------------------------------- 1 | ;-------------------------------------------------------------------------------------------------------- 2 | ; x64dbg plugin SDK for Masm32 - fearless 2015 3 | ; 4 | ; Export definition file for your plugin 5 | ;-------------------------------------------------------------------------------------------------------- 6 | 7 | LIBRARY AutoCmdLine 8 | EXPORTS ; Main plugin exports - only pluginit is required, but others can be included for ease of use. 9 | ; 10 | pluginit 11 | plugstop 12 | plugsetup 13 | ; 14 | ; Plugin callbacks - only export (uncomment) the callbacks you are using in your plugin, comment out the others. 15 | ; 16 | CBINITDEBUG 17 | ;CBSTOPDEBUG 18 | ;CBCREATEPROCESS 19 | ;CBEXITPROCESS 20 | ;CBCREATETHREAD 21 | ;CBEXITTHREAD 22 | CBSYSTEMBREAKPOINT 23 | ;CBLOADDLL 24 | ;CBUNLOADDLL 25 | ;CBOUTPUTDEBUGSTRING 26 | ;CBEXCEPTION 27 | ;CBBREAKPOINT 28 | ;CBPAUSEDEBUG 29 | ;CBRESUMEDEBUG 30 | ;CBSTEPPED 31 | ;CBATTACH 32 | ;CBDETACH 33 | ;CBDEBUGEVENT 34 | CBMENUENTRY 35 | ;CBWINEVENT 36 | ;CBWINEVENTGLOBAL 37 | -------------------------------------------------------------------------------- /AutoCmdLine.Inc: -------------------------------------------------------------------------------- 1 | ;===================================================================================== 2 | ; x64dbg plugin SDK for Masm - fearless 2015 3 | ; 4 | ; AutoCmdLine.inc 5 | ; 6 | ;------------------------------------------------------------------------------------- 7 | include windows.inc 8 | include CommCtrl.inc 9 | include shellapi.inc 10 | include wincrypt.INC 11 | 12 | includelib user32.lib 13 | includelib kernel32.lib 14 | includelib gdi32.lib 15 | includelib comctl32.lib 16 | includelib shell32.lib 17 | includelib Crypt32.Lib 18 | 19 | AddCmdLineDlgProc PROTO :HWND, :UINT, :WPARAM, :LPARAM 20 | AutoCmdLineCreateHash PROTO :QWORD, :QWORD 21 | AutoCmdLineLoadMenuIcon PROTO :QWORD, :QWORD 22 | 23 | .CONST 24 | CRLF TEXTEQU <13,10,0> ; carriage return and linefeed for strings that require them (GuiAddLogMessage for example) 25 | 26 | CRYPT_STRING_NOCRLF EQU 40000000h 27 | 28 | CRYPT_STRING_HEXRAW EQU 0000000ch 29 | 30 | ICO_AUTOCMDLINE EQU 100 31 | IMG_AUTOCMDLINE EQU 101 ; PNG image for plugin menu icon 32 | 33 | MENU_PLUGIN1 EQU 1 34 | ;IDD_PluginDlg EQU 1000 35 | ;IDC_PLUGINDLG_OK EQU 1001 36 | 37 | ;AddChangeCmdLine.dlg 38 | IDD_AddCmdLine equ 1000 39 | IDC_LblAddCmdLineModuleFilename equ 1001 40 | IDC_LblAddCmdLineCommandLine equ 1003 41 | IDC_TxtAddCmdLineCommandLine equ 1004 42 | IDC_TxtAddCmdLineModuleFilename equ 1002 43 | IDC_BtnAddCmdLineOK equ 1005 44 | IDC_ChkAddCmdLineRemember equ 1006 45 | IDC_BtnAddCmdLineCancel equ 1007 46 | 47 | .DATA 48 | align 01 49 | szMenuPlugin1 DB "Add/Change CmdLine...",0 50 | 51 | szAutoCmdLineInfo DB 13,10 52 | DB "AutoCmdLine x64dbg plugin by fearless 2015 - www.LetTheLight.in",13,10 53 | DB 13,10 54 | DB "AutoCmdLine Features & Usage:",13,10 55 | DB " - Adds a dialog (from plugin menu) where you can see and change command line",13,10 56 | DB " - Option to remember command line for next time the same module is loaded",13,10 57 | DB " - Auto sets command line when loading a module - if it was set to remember it",13,10 58 | DB 13,10,0 59 | 60 | szPluginLoaded DB "AutoCmdLine loaded.",CRLF 61 | szPluginUnloaded DB "AutoCmdLine unloaded.",CRLF 62 | szDebuggingRequired DB "AutoCmdLine: You need to be debugging to use this option!",CRLF 63 | szAutoCmdLineManualChange DB "AutoCmdLine: Command line has been changed to: ",0 64 | szAutoCmdLineAutoChange DB "AutoCmdLine: Command line has been automatically changed to: ",0 65 | szAutoCmdLineRemember DB "AutoCmdLine: Command line will be remembered: ",0 66 | szAutoCmdLineForgotten DB "AutoCmdLine: Command line wont be remembered (its forgotten already): ",0 67 | szLogMsg DB 1024 DUP (0) 68 | 69 | 70 | 71 | szErrorCryptHashData DB "AutoCmdLine Error: HashData",CRLF 72 | szErrorCryptCreateHash DB "AutoCmdLine Error: CryptCreateHash",CRLF 73 | szErrorCryptAcquireContext DB "AutoCmdLine Error: CryptAcquireContext",CRLF 74 | szErrorCryptGetHashParamSize DB "AutoCmdLine Error: CryptGetHashParam::Size",CRLF 75 | szErrorCryptGetHashParamVal DB "AutoCmdLine Error: CryptGetHashParam::Value",CRLF 76 | szCreateHashSuccess DB "AutoCmdLine Error: CreateHash Success: ",0 77 | szZeroLengthHash DB "Zero Length Hash",CRLF 78 | szErrorGlobalAlloc DB "AutoCmdLine Error: GlobalAlloc",CRLF 79 | szIniGetModuleCmdLine DB "IniGetModuleCmdLine: ",0 80 | szIniSetModuleCmdLine DB "IniSetModuleCmdLine: ",0 81 | szCBINITDEBUG DB "AutoCmdLine (MD5): ",0 82 | 83 | 84 | 85 | szIni DB "ini",0 86 | AutoCmdLineIni DB MAX_PATH DUP (0) 87 | szModuleFilename DB MAX_PATH DUP (0) 88 | szCommandLine DB 1024 DUP (0) 89 | szNewCommandLine DB 1024 DUP (0) 90 | dwCmdLineSize DD 0 91 | dqRemember DQ 0 92 | 93 | DebugFilename DQ 0 94 | DebugFilenameMD5 DB 256 DUP (0) 95 | ;dbgfilename_md5ctext MD5CTXT <> 96 | ;dbgfilename_md5chash MD5HASH <> 97 | 98 | szGetCmdLine DB "GetCommandLine",0 99 | szIniCmdLine DB "CmdLine",0 100 | szIniRemember DB "Remember",0 101 | szCRLF DB 13,10,0 102 | szColon DB ":",0 103 | szQuote DB 22h,0 104 | szZero DB "0",0 105 | szOne DB "1",0 106 | szQ DB "?",0 107 | szSpace DB " ",0 108 | sel SELECTIONDATA <> 109 | 110 | .DATA? 111 | align 08 112 | hInstance HINSTANCE ? 113 | hIcoAutoCmdLine DD ? 114 | -------------------------------------------------------------------------------- /AutoCmdLine.rap: -------------------------------------------------------------------------------- 1 | [Project] 2 | Assembler=JWasm 3 | Type=Dll64 Project 4 | Description=AutoCmdLine 5 | Backup=$P\Bak\ 6 | Group=1 7 | GroupExpand=1 8 | Res.rc=1 9 | Ver.rc=1 10 | [Files] 11 | 1=AutoCmdLine.Asm 12 | 2=AutoCmdLine.Inc 13 | 3=AutoCmdLine.Def 14 | 4=AutoCmdLine.rc 15 | 5= 16 | 6=AutoCmdLine-readme.txt 17 | 7=AutoCmdLineIni.asm 18 | 8=AddChangeCmdLine.dlg 19 | [MakeFiles] 20 | 0=AutoCmdLine.rap 21 | 1=AutoCmdLine.rc 22 | 2=AutoCmdLine.asm 23 | 3=AutoCmdLine.obj 24 | 4=AutoCmdLine.res 25 | 5=AutoCmdLine.exe 26 | 6=AutoCmdLine.def 27 | 7=AutoCmdLine.dll 28 | 8=AutoCmdLine.txt 29 | 9=AutoCmdLine.lib 30 | 10=AutoCmdLine.mak 31 | 11=AutoCmdLine.hla 32 | 12=AutoCmdLine.com 33 | 13=AutoCmdLine.ocx 34 | 14=AutoCmdLine.idl 35 | 15=AutoCmdLine.tlb 36 | 16=AutoCmdLine.sys 37 | 17=AutoCmdLine.dp64 38 | 18=AutoCmdLine.pdb 39 | [MakeDef] 40 | Menu=1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 41 | 1=4,O,$B\RC.EXE /v,1 42 | 2=3,O,$B\JWASM64.EXE /c -win64 -Zp8 /Zi /win64 /D_WIN64 /Cp /nologo /W2 /I"$I",2 43 | 3=7,O,$B\LINK.EXE /SUBSYSTEM:WINDOWS /RELEASE /DLL /DEF:$6 /LIBPATH:"$L" /OUT:"$17",3,4 44 | 4=0,0,,5 45 | 5=rsrc.obj,O,$B\CVTRES.EXE,rsrc.res 46 | 6=*.obj,O,$B\JWASM64.EXE /c -win64 -Zp8 /Zi /win64 /D_WIN64 /Cp /nologo /W2 /I"$I",*.asm 47 | 7=0,0,"$E\x64\x64dbg",5 48 | 11=4,O,$B\RC.EXE /v,1 49 | 12=3,O,$B\JWASM64.EXE /c -win64 -Zp8 /Zi /win64 /D_WIN64 /Cp /nologo /W2 /Zi /Zd /nologo /I"$I",2 50 | 13=7,O,$B\LINK.EXE /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"$18" /DLL /DEF:$6 /LIBPATH:"$L" /OUT:"$17",3,4 51 | 14=0,0,,5 52 | 15=rsrc.obj,O,$B\CVTRES.EXE,rsrc.res 53 | 16=*.obj,O,$B\JWASM64.EXE /c -win64 -Zp8 /Zi /win64 /D_WIN64 /Cp /nologo /W2 /I"$I",*.asm 54 | 17=0,0,"$E\x64\x64dbg",$.exe 55 | [Resource] 56 | 1=,1,8,AutoCmdLine.xml 57 | 2=,101,7,Images\AutoCmdLine.png 58 | 3=,100,2,Images\AutoCmdLine.ico 59 | [StringTable] 60 | [Accel] 61 | [VerInf] 62 | Nme=VERINF1 63 | ID=1 64 | FV=1.0.0.4 65 | PV=1.0.0.4 66 | VerOS=0x00000004 67 | VerFT=0x00000002 68 | VerLNG=0x00000409 69 | VerCHS=0x000004B0 70 | ProductVersion=1.0.0.4 71 | ProductName=AutoCmdLine 72 | OriginalFilename=AutoCmdLine.dp64 73 | LegalTrademarks=fearless (C) 2016 www.LetTheLight.in 74 | LegalCopyright=fearless (C) 2016 www.LetTheLight.in 75 | InternalName=AutoCmdLine.dll 76 | FileDescription=AutoCmdLine plugin for x64dbg 77 | FileVersion=1.0.0.4 78 | CompanyName=fearless @ www.LetTheLight.in 79 | [Group] 80 | Group=Assembly,Resources,Misc 81 | 1=1 82 | 2=1 83 | 3=1 84 | 4=2 85 | 5= 86 | 6=3 87 | 7=1 88 | 8=2 89 | 9= 90 | 10= 91 | 11= 92 | [AutoLoad] 93 | AutoLoad=1,2,7,8,3,4,6 94 | [RADebugBP] 95 | 2= 96 | 1= 97 | 7= 98 | 3= 99 | 4= 100 | [VersionControl] 101 | Settings=1279 102 | Milestones=129 103 | MilestoneEvery=10 104 | MilestoneEveryCurrent=0 105 | MilestoneOnBuild=0.0.0.0 106 | MilestoneOnTime=2 107 | MilestoneOnDate=0 108 | MilestoneOnDateWhen=1 109 | MilestoneOnDateStatus=0 110 | MilestoneOnDateDate=13 111 | MilestoneOnDateTimeYear=2015 112 | MilestoneOnDateTimeMonth=4 113 | MilestoneOnDateTimeDate=24 114 | MilestoneOnDateTimeHour=2 115 | MilestoneOnDateTimeMin=32 116 | MilestoneOnDateTimeSec=49 117 | MilestoneOnDateTimeStatus=0 118 | BackupLocation=M:\radasm\JWasm\Projects\VCBackups\ 119 | CompressionLevel=0 120 | DefaultComment=Project $N, $Z, Backup Created On $D At $T. 121 | ExcludeExt1=\ 122 | ExcludeExt2=\ 123 | ExcludeExt3=\ 124 | ExcludeExt4=\ 125 | FileVerLength=4 126 | FileVer2Range=0 127 | FileVer3Range=0 128 | FileVer4Range=0 129 | ProductVerLength=4 130 | ProductVer2Range=0 131 | ProductVer3Range=0 132 | ProductVer4Range=0 133 | [PTimer] 134 | PTimer=27438252 135 | [Collapse] 136 | 1=814223360, 137 | 2= 138 | 7= 139 | 3= 140 | 4= 141 | 6= 142 | [Size] 143 | 1=0,0,0,0,7201 144 | 2=0,0,0,0,4187 145 | 7=0,0,0,0,377 146 | 5=0,0,0,0 147 | 3=0,0,0,0,772 148 | 8=0,0,0,0 149 | 4=0,0,0,0,38 150 | 6=0,0,0,0,1462 151 | [GroupExpand] 152 | GroupExpand=1,1,1,0 153 | [BookMark] 154 | 0= 155 | 1= 156 | 2= 157 | 3= 158 | 4= 159 | 5= 160 | 6= 161 | 7= 162 | 8= 163 | 9= 164 | [BreakPoint] 165 | 0= 166 | [Find] 167 | 1="_Dbg" 168 | 2="sel" 169 | 3="szModuleFilename" 170 | 4="qwNewRemember" 171 | -------------------------------------------------------------------------------- /AutoCmdLine.rc: -------------------------------------------------------------------------------- 1 | #include "Res/AddChangeCmdLineDlg.rc" 2 | #include "Res/AutoCmdLineRes.rc" 3 | #include "Res/AutoCmdLineVer.rc" 4 | -------------------------------------------------------------------------------- /AutoCmdLine.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | AutoCmdLine 12 | 13 | 14 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /AutoCmdLineIni.asm: -------------------------------------------------------------------------------- 1 | 2 | include winreg.INC 3 | ;include advapi32.inc 4 | includelib advapi32.lib 5 | 6 | IniGetModuleCmdLine PROTO :QWORD, :QWORD, :QWORD 7 | IniSetModuleCmdLine PROTO :QWORD, :QWORD, :QWORD 8 | 9 | .CONST 10 | 11 | 12 | .DATA 13 | 14 | 15 | .DATA? 16 | 17 | 18 | .CODE 19 | 20 | ;===================================================================================== 21 | ; Get cmdline for specified debugfilename (hashed value of it) from our ini 22 | ;------------------------------------------------------------------------------------- 23 | IniGetModuleCmdLine PROC FRAME USES RBX lpszModuleFilename:QWORD, lpszCommandLine:QWORD, lpqwRememberOption:QWORD 24 | LOCAL szIniCommandLineString[MAX_PATH+2]:BYTE 25 | LOCAL lenModuleFilename:DWORD 26 | 27 | Invoke lstrlen, Addr DebugFilenameMD5 28 | .IF eax == 0 ; havnt got the hash of this module name yet, so do it now 29 | 30 | ; Invoke lstrlen, lpszModuleFilename 31 | ;mov lenModuleFilename, eax 32 | 33 | ; create hash of module filename and path to check in our .ini file for cmd line entry 34 | Invoke AutoCmdLineCreateHash, lpszModuleFilename, Addr DebugFilenameMD5 35 | 36 | Invoke lstrcpy, Addr szLogMsg, Addr szIniGetModuleCmdLine 37 | Invoke lstrcat, Addr szLogMsg, Addr DebugFilenameMD5 38 | Invoke lstrcat, Addr szLogMsg, Addr szCRLF 39 | Invoke GuiAddLogMessage, Addr szLogMsg 40 | 41 | ;invoke MD5_Startup 42 | ;invoke MD5_Init, offset dbgfilename_md5ctext 43 | ;invoke MD5_Read, offset dbgfilename_md5ctext, lpszModuleFilename, lenModuleFilename 44 | ;invoke MD5_Digest, offset dbgfilename_md5ctext, offset dbgfilename_md5chash 45 | ;invoke MD52StringA, offset dbgfilename_md5chash, offset DebugFilenameMD5, 1 46 | 47 | IFDEF DEBUG32 48 | PrintText 'IniGetModuleCmdLine' 49 | PrintString DebugFilenameMD5 50 | ENDIF 51 | .ENDIF 52 | 53 | Invoke GetPrivateProfileString, Addr DebugFilenameMD5, Addr szIniCmdLine, Addr szColon, Addr szIniCommandLineString, SIZEOF szIniCommandLineString, Addr AutoCmdLineIni 54 | .IF eax == 0 || eax == 1 ; just got nothing or the colon and nothing else, so no command line stored for this 55 | mov rbx, lpszCommandLine 56 | mov byte ptr [rbx], 0 57 | mov rax, FALSE 58 | .ELSE 59 | Invoke GetPrivateProfileInt, Addr DebugFilenameMD5, Addr szIniRemember, 0, Addr AutoCmdLineIni 60 | mov rbx, lpqwRememberOption 61 | mov [rbx], rax 62 | 63 | Invoke lstrcpy, lpszCommandLine, Addr szQuote 64 | Invoke lstrcat, lpszCommandLine, Addr szIniCommandLineString 65 | Invoke lstrcat, lpszCommandLine, Addr szQuote 66 | ;Invoke lstrcpy, lpszCommandLine, Addr szIniCommandLineString 67 | mov rax, TRUE 68 | .ENDIF 69 | ret 70 | 71 | IniGetModuleCmdLine endp 72 | 73 | 74 | ;===================================================================================== 75 | ; Set cmdline for the specified debugfilename (that is hashed) into our ini 76 | ;------------------------------------------------------------------------------------- 77 | IniSetModuleCmdLine PROC FRAME USES RBX lpszModuleFilename:QWORD, lpszCommandLine:QWORD, qwRememberOption:QWORD 78 | LOCAL szIniCommandLineString[MAX_PATH]:BYTE 79 | LOCAL lenModuleFilename:DWORD 80 | 81 | ; create hash of module filename and path to check in our .ini file for cmd line entry 82 | Invoke AutoCmdLineCreateHash, lpszModuleFilename, Addr DebugFilenameMD5 83 | 84 | Invoke lstrcpy, Addr szLogMsg, Addr szIniSetModuleCmdLine 85 | Invoke lstrcat, Addr szLogMsg, Addr DebugFilenameMD5 86 | Invoke lstrcat, Addr szLogMsg, Addr szSpace 87 | Invoke lstrcat, Addr szLogMsg, lpszModuleFilename 88 | Invoke lstrcat, Addr szLogMsg, Addr szCRLF 89 | Invoke GuiAddLogMessage, Addr szLogMsg 90 | 91 | Invoke WritePrivateProfileString, Addr DebugFilenameMD5, Addr szIniCmdLine, lpszCommandLine, Addr AutoCmdLineIni 92 | .IF qwRememberOption == 0 93 | Invoke WritePrivateProfileString, Addr DebugFilenameMD5, Addr szIniRemember, Addr szZero, Addr AutoCmdLineIni 94 | .ELSE 95 | Invoke WritePrivateProfileString, Addr DebugFilenameMD5, Addr szIniRemember, Addr szOne, Addr AutoCmdLineIni 96 | .ENDIF 97 | ret 98 | 99 | IniSetModuleCmdLine endp 100 | 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoCmdLine Plugin (x64) - A Plugin For x64dbg 2 | 3 | ![](https://github.com/mrfearless/AutoCmdLine-Plugin-x64/blob/master/images/AutoCmdLine.png) [Current version: 1.0.0.4 - Last updated: 09/08/2016](https://github.com/mrfearless/AutoCmdLine-Plugin-x64/releases/latest) For the x86 version of this plugin, visit [here](https://github.com/mrfearless/AutoCmdLine-Plugin-x86) 4 | 5 | ## Overview 6 | 7 | A plugin to remember the command line and load it up automatically 8 | 9 | ## Features 10 | 11 | * Add and/or change command line 12 | * Remember command line 13 | * Automatically set command line 14 | 15 | ## How to install 16 | 17 | * If x64dbg (x64dbg 64bit) is currently running, stop and exit. 18 | * Copy the `AutoCmdLine.dp64` to your `x64dbg\x64\plugins` folder. 19 | * Start x64dbg 20 | 21 | ## Notes 22 | 23 | AutoCmdLine takes the modulename, the full filepath of the program that is loaded and being debugged and creates an MD5 hash from this value. 24 | It searches in the plugins\AutoCmdLine.ini file for a matching profile section name and loads up the saved command line if it was set to 'remember' it. 25 | 26 | 'remember' perhaps should be named auto-load as it will auto load this command line the next time the same module is being debugged. 27 | 28 | Arguments on the command line should be wrapped with double quotes "" and you should specify the fullpath for any arguments that require it. 29 | 30 | This is to ensure compatability with windows and how it handles arguments and also with the way x64dbg sets the cmdline. 31 | 32 | ## Information 33 | 34 | * Written by [fearless](https://github.com/mrfearless) - [www.LetTheLight.in](http://www.LetTheLight.in) 35 | * Created with the [x64dbg Plugin SDK For x64 Assembler](https://github.com/mrfearless/x64dbg-Plugin-SDK-For-x64-Assembler) 36 | * A RadASM project (.rap) is used to manage and compile the plugin. The RadASM IDE can be downloaded [here](http://www.softpedia.com/get/Programming/File-Editors/RadASM.shtml) 37 | * The x64 version of this plugin uses [JWasm64](http://masm32.com/board/index.php?topic=3795.0) 38 | * The [JWasm for RadASM package](http://masm32.com/board/index.php?topic=4162.0) is also required to build this x64 version. 39 | 40 | ## x64dbg 41 | * [x64dbg website](http://x64dbg.com) 42 | * [x64dbg github](https://github.com/x64dbg/x64dbg) 43 | * [x64dbg gitter](https://gitter.im/x64dbg/x64dbg) 44 | -------------------------------------------------------------------------------- /images/AutoCmdLine.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrfearless/AutoCmdLine-Plugin-x64/07784023eb1f2754c7f2bcdc8470935be2c36c46/images/AutoCmdLine.ico -------------------------------------------------------------------------------- /images/AutoCmdLine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrfearless/AutoCmdLine-Plugin-x64/07784023eb1f2754c7f2bcdc8470935be2c36c46/images/AutoCmdLine.png -------------------------------------------------------------------------------- /release/AutoCmdLine-readme.txt: -------------------------------------------------------------------------------- 1 | ;===================================================================================== 2 | ; 3 | ; AutoCmdLine-readme.txt 4 | ; 5 | ; v1.0.0.4 - Last updated: 09/08/2016 6 | ; 7 | ;------------------------------------------------------------------------------------- 8 | 9 | About 10 | ----- 11 | 12 | AutoCmdLine Plugin (x64) For x64dbg (64bit plugin) 13 | by fearless - www.LetTheLight.in 14 | 15 | Created with the x64dbg Plugin SDK For x64 Assembler 16 | https://github.com/mrfearless/x64dbg-Plugin-SDK-For-x64-Assembler 17 | 18 | 19 | Overview 20 | -------- 21 | 22 | A plugin to remember the command line and load it up automatically 23 | 24 | 25 | Features 26 | -------- 27 | 28 | - Add and/or change command line 29 | - Remember command line 30 | - Automatically set command line 31 | 32 | 33 | Notes 34 | ----- 35 | 36 | AutoCmdLine takes the modulename, the full filepath of the program that is loaded and 37 | being debugged and creates an MD5 hash from this value. 38 | It searches in the plugins\AutoCmdLine.ini file for a matching profile section name 39 | and loads up the saved command line if it was set to 'remember' it. 40 | 41 | 'remember' perhaps should be named auto-load as it will auto load this command line 42 | the next time the same module is being debugged. 43 | 44 | Arguments on the command line should be wrapped with double quotes "" 45 | and you should specify the fullpath for any arguments that require it. 46 | 47 | This is to ensure compatability with windows and how it handles arguments and also 48 | with the way x64dbg sets the cmdline. 49 | 50 | - 09/08/2016 Added fix for full command line to be set, previously only saved portion was 51 | - 26/06/2016 Updated x64dbg SDK for masm to version 1.0.0.3 and recompiled plugin. 52 | - 01/03/2016 Updated x64dbg SDK for masm to version 1.0.0.2 and recompiled plugin. 53 | - Added function AutoCmdLineLoadMenuIcon to load png resource image as raw bytes 54 | - Added menu icon for plugin (uses _plugin_menuseticon) -------------------------------------------------------------------------------- /release/AutoCmdLine.dp64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrfearless/AutoCmdLine-Plugin-x64/07784023eb1f2754c7f2bcdc8470935be2c36c46/release/AutoCmdLine.dp64 -------------------------------------------------------------------------------- /res/AddChangeCmdLineDlg.rc: -------------------------------------------------------------------------------- 1 | #define IDD_AddCmdLine 1000 2 | #define IDC_LblAddCmdLineModuleFilename 1001 3 | #define IDC_LblAddCmdLineCommandLine 1003 4 | #define IDC_TxtAddCmdLineCommandLine 1004 5 | #define IDC_TxtAddCmdLineModuleFilename 1002 6 | #define IDC_BtnAddCmdLineOK 1005 7 | #define IDC_ChkAddCmdLineRemember 1006 8 | #define IDC_BtnAddCmdLineCancel 1007 9 | IDD_AddCmdLine DIALOGEX 6,6,359,64 10 | CAPTION "AutoCmdLine - Add or change command line" 11 | FONT 8,"Segoe UI",400,0 12 | STYLE 0x10C80800 13 | EXSTYLE 0x00000000 14 | BEGIN 15 | CONTROL "Module Filename:",IDC_LblAddCmdLineModuleFilename,"Static",0x50000000,5,4,64,12,0x00000000 16 | CONTROL "",IDC_TxtAddCmdLineModuleFilename,"Edit",0x50010880,74,4,278,12,0x00000200 17 | CONTROL "Command Line:",IDC_LblAddCmdLineCommandLine,"Static",0x50000000,5,22,66,12,0x00000000 18 | CONTROL "",IDC_TxtAddCmdLineCommandLine,"Edit",0x50010180,74,22,278,12,0x00000200 19 | CONTROL "Remember This Command Line",IDC_ChkAddCmdLineRemember,"Button",0x50010003,74,41,123,12,0x00000000 20 | CONTROL "&Cancel",IDC_BtnAddCmdLineCancel,"Button",0x50010000,202,41,72,15,0x00000000 21 | CONTROL "O&K",IDC_BtnAddCmdLineOK,"Button",0x50010001,280,41,72,15,0x00000000 22 | END 23 | -------------------------------------------------------------------------------- /res/AutoCmdLineRes.rc: -------------------------------------------------------------------------------- 1 | #define MANIFEST 24 2 | 1 MANIFEST DISCARDABLE "AutoCmdLine.xml" 3 | 101 RCDATA DISCARDABLE "Images/AutoCmdLine.png" 4 | 100 ICON DISCARDABLE "Images/AutoCmdLine.ico" 5 | -------------------------------------------------------------------------------- /res/AutoCmdLineVer.rc: -------------------------------------------------------------------------------- 1 | #define VERINF1 1 2 | VERINF1 VERSIONINFO 3 | FILEVERSION 1,0,0,4 4 | PRODUCTVERSION 1,0,0,4 5 | FILEOS 0x00000004 6 | FILETYPE 0x00000002 7 | BEGIN 8 | BLOCK "StringFileInfo" 9 | BEGIN 10 | BLOCK "040904B0" 11 | BEGIN 12 | VALUE "CompanyName", "fearless @ www.LetTheLight.in\0" 13 | VALUE "FileVersion", "1.0.0.4\0" 14 | VALUE "FileDescription", "AutoCmdLine plugin for x64dbg\0" 15 | VALUE "InternalName", "AutoCmdLine.dll\0" 16 | VALUE "LegalCopyright", "fearless (C) 2016 www.LetTheLight.in\0" 17 | VALUE "LegalTrademarks", "fearless (C) 2016 www.LetTheLight.in\0" 18 | VALUE "OriginalFilename", "AutoCmdLine.dp64\0" 19 | VALUE "ProductName", "AutoCmdLine\0" 20 | VALUE "ProductVersion", "1.0.0.4\0" 21 | END 22 | END 23 | BLOCK "VarFileInfo" 24 | BEGIN 25 | VALUE "Translation", 0x0409, 0x04B0 26 | END 27 | END 28 | --------------------------------------------------------------------------------