blob: 3e0319360f7442e046f5d65d755cdbb32d4cbc18 (
plain)
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
|
#!/usr/bin/env python
import fileinput
import os
import sys
import shlex
import subprocess
import re
colourFormat = '\033[{0}m'
colourStr = colourFormat.format(32)
resetStr = colourFormat.format(0)
#while True:
# try:
# c = sys.stdin.buffer.read(1)
# except EOFError:
# print("EOF")
# break;
# print(c)
# sys.stdout.buffer.write(c)
for line in fileinput.input():
# print re.sub(r'([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})', colourStr+ r'\1' + resetStr, line),
ips=re.findall(r'([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})', line)
for ip in ips:
print "ipv4 detected: "+colourStr+ip+resetStr
|