-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhoneypotSS
27 lines (23 loc) · 1.05 KB
/
honeypotSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python
import socket
import os
puerto = 23 #23 puerto telnet (el mas atacado) otros 22 y 445
honey_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
honey_socket.bind( ('', puerto) )
honey_socket.listen( 1 )
print 'Honeypot a la escucha puerto: ', puerto
while True:
conexion_entrante,info_conexion = honey_socket.accept()
try:
conexion_entrante.send('Ups... te has equivocado esto es un honeypot\r\n')
except socket.error, e:
print "honeypotSS2 error en socket:", e, "=> nmap -ST", info_conexion[0]
conexion_entrante.close()
print "honeypot conexion desde " , info_conexion[0]
#os.system("logger -p auth.info honeypot conexion desde "+ info_conexion[0])
#os.system("iptables -A INPUT -s " + info_conexion[0] + " -j DROP ")
os.system("fail2ban-client set ssh banip "+info_conexion[0])
#os.system("curl 'http://honeymap_server/ipban?ip="+info_conexion[0]+"&m=honeypotSS192'&")#ojo con los &
#os.system("echo "+info_conexion[0]+" > /dev/udp/honeymap_server/1234")
honey_socket.close()
print 'Fin programa!'