2015-06-27 33 views
1


我有二进制文件,并运行与此代码的批处理文件:我可以发送答案的二进制文件与批处理文件

call "login.exe" site sample.com -user myusername 

然后比纳尔文件(“LOGIN.EXE”)等待插入密码(请从标准输入密码)
,我想从批处理文件中使用

我从这个代码

使用回声或sendkey发送密码到

我该怎么办?这可能吗?

+0

我想你可以通过从login.exe运行脚本将它发回... – Proxytype

+0

@Proxytype我不能编辑二进制文件!又怎样 ? – Sara

+1

你可以做一个肮脏的把戏,并听取所有输入,通过附加到每个打开的窗口,我可以添加例如,如果它有趣... – Proxytype

回答

-1

这是一个很好的点开始,如果你想从另一个应用程序

using System; 
using System.Collections.Generic; 
using System.Text; 
using System.Runtime.InteropServices; 

namespace keystroke 
{ 
    public class handler 
    { 
     public const int WM_SYSCOMMAND = 0x0112; 
     public const int SC_CLOSE = 0xF060; 

    [DllImport("user32.dll")] 
    public static extern int FindWindow(
     string lpClassName, 
     string lpWindowName 
    ); 

    [DllImport("user32.dll")] 
    public static extern int SetForegroundWindow(
     int hWnd 
    ); 

    private const int GWL_EXSTYLE = (-20); 
    private const int WS_EX_TOOLWINDOW = 0x80; 
    private const int WS_EX_APPWINDOW = 0x40000; 

    public const int GW_HWNDFIRST = 0; 
    public const int GW_HWNDLAST = 1; 
    public const int GW_HWNDNEXT = 2; 
    public const int GW_HWNDPREV = 3; 
    public const int GW_OWNER = 4; 
    public const int GW_CHILD = 5; 

    public delegate int EnumWindowsProcDelegate(int hWnd, int lParam); 

    [DllImport("User32.Dll")] 
    public static extern void GetWindowText(int h, StringBuilder s, int nMaxCount); 

    [DllImport("user32", EntryPoint = "GetWindowLongA")] 
    public static extern int GetWindowLongPtr(int hwnd, int nIndex); 

    [DllImport("user32")] 
    public static extern int GetParent(int hwnd); 

    [DllImport("user32")] 
    public static extern int GetWindow(int hwnd, int wCmd); 

    [DllImport("user32")] 
    public static extern int IsWindowVisible(int hwnd); 

    [DllImport("user32")] 
    public static extern int GetDesktopWindow(); 

} 
} 

你可以找到与打开的窗口进行交互,如果窗口上的焦点,并积极键盘记录程序,但是这是恶意的......

+0

这是什么语言?这段代码应该如何使用? – SomethingDark

+0

C#调用win32 api函数 – Proxytype

+0

您如何期望批处理运行C#? – SomethingDark