File: bldcheck.py

package info (click to toggle)
bld 0.3.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 496 kB
  • ctags: 252
  • sloc: ansic: 2,307; perl: 180; makefile: 141; sh: 106; python: 36
file content (30 lines) | stat: -rwxr-xr-x 523 bytes parent folder | download | duplicates (3)
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
28
29
30
#!/usr/bin/python
#
# Usage: bldcheck.py host port ip
#
# Connect to bld on host:port to check if ip is blacklisted
#

import sys, socket

MAX_CMD_LEN = 80

if len(sys.argv) < 4:
   print "Usage: "+sys.argv[0]+" host port ip"
   sys.exit(1)

host = sys.argv[1]
port = int(sys.argv[2])
ip = sys.argv[3]

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))

data = s.recv(MAX_CMD_LEN)
if not data:
   s.close()
s.send("ip?="+ip+"\r\n")
data = s.recv(MAX_CMD_LEN)
s.close()
data.rstrip()
print data,