我可以用批处理文件将答案发送到二进制文件吗
can i send answer to binary file with batch file
我有二进制文件和 运行 带有此代码的批处理文件:
call "login.exe" site sample.com -user myusername
然后是二进制文件 ("login.exe") 等待插入密码(从标准输入询问密码)
我想用 echo 或 sendkey 发送密码到使用批处理文件
我正在使用此代码
call run_binary.bat
timeout /t 1
%SendKeys% "password{ENTER}"
我能做什么?这可能吗?
如果您想从另一个应用程序
与 open windows 交互,这是一个很好的起点
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();
}
}
如果 window 处于焦点状态并激活键盘记录器,您可以找到它,但这是恶意的...
我有二进制文件和 运行 带有此代码的批处理文件:
call "login.exe" site sample.com -user myusername
然后是二进制文件 ("login.exe") 等待插入密码(从标准输入询问密码)
我想用 echo 或 sendkey 发送密码到使用批处理文件
我正在使用此代码
call run_binary.bat
timeout /t 1
%SendKeys% "password{ENTER}"
我能做什么?这可能吗?
如果您想从另一个应用程序
与 open windows 交互,这是一个很好的起点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();
}
}
如果 window 处于焦点状态并激活键盘记录器,您可以找到它,但这是恶意的...