-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmxhelp
More file actions
80 lines (69 loc) · 2.45 KB
/
mxhelp
File metadata and controls
80 lines (69 loc) · 2.45 KB
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
#!/bin/bash
if [ $# -ne 2 ]; then
echo "You need a Host-IP and Target-IP"
echo "Example: mxhelp hostip targetip"
exit 1
fi
IP=$1
TGT=$2
echo ""
echo "Mike is Helping..."
ipold=$(cat ~/mxhelp/z_myip)
tgtold=$(cat ~/mxhelp/z_tgt)
echo 'UPDATE IP :' $ipold '-->' $IP
echo 'UPDATE TGT:' $tgtold '-->' $TGT
if [[ ! $IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "IP not valid."
exit 1
elif [[ ! $TGT =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Target IP not valid."
exit 1
elif [[ $IP = $TGT ]]; then
echo "IP and TGT are the same. Abort - You will wreak havoc."
exit 1
elif [[ $IP = $tgtold ]]; then
echo "IP and OLDTGT are the same. Abort - You will wreak havoc."
exit 1
elif [[ $TGT = $ipold ]]; then
echo "TGT and OLDIP are the same. Abort - You will wreak havoc."
exit 1
fi
#Search and fix
find ~/mxhelp/mx* -type f -exec sed -i 's/'"$ipold"'/'"$IP"'/gI' {} \;
find ~/mxhelp/mx* -type f -exec sed -i 's/'"$tgtold"'/'"$TGT"'/gI' {} \;
#Update to capture latest
echo $IP > ~/mxhelp/z_myip
echo $TGT > ~/mxhelp/z_tgt
echo "-------------------------------------"
echo "Initial nmap"
echo -e "\e[1;35m"
echo "sudo nmap -p- --min-rate=1000 -T4 -v" $TGT "-Pn | tee nmap-ports"
echo "ports=\$(grep ^[0-9] ./nmap-ports | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//)"
echo "echo -e '\nPorts-to-Scan:'" $ports
echo "sudo nmap -sV -sC -v -p \$ports" $TGT "-Pn -oA nmap-fulltcp | tee nmap-tee"
echo "echo -e '\nSummary:'"
echo "grep ^[0-9] ./nmap-tee"
echo -e "\e[1;m"
echo "-------------------------------------"
echo "HTML Results"
echo -e "\e[1;35m"
echo "xsltproc nmap-fulltcp.xml ~/tools/nmapxml/honze.xsl -o nmap-fulltcp.html"
echo "firefox nmap-fulltcp.html &"
echo -e "\e[1;m"
echo "-------------------------------------"
echo "Consider UDP"
echo -e "\e[1;35m"
echo "sudo nmap -sU -T 5 --top-ports 20 -v" $TGT "| tee nmap-udp20"
echo "sudo nmap -sU -T 5 --top-ports 1000 -v -Pn" $TGT "| tee nmap-udp1000"
echo "nc" $TGT "-u 27960"
echo -e "\e[1;m"
echo "-------------------------------------"
echo "Consider nmapAutomator"
echo "sudo nmapAutomator.sh -H" $TGT "-t Script | tee nmap-auto-script"
echo "sudo nmapAutomator.sh -H" $TGT "-t Vulns | tee nmap-auto-vulns"
echo "sudo nmapAutomator.sh -H" $TGT "-t Recon | tee nmap-auto-recon"
echo "sudo nmapAutomator.sh -H" $TGT "-t All | tee nmap-auto-all"
echo "-------------------------------------"
echo "More"
ls ~/mxhelp/
echo ""