Skip to content
Snippets Groups Projects
Commit 23479c332cce authored by Jean-Francois Pieronne's avatar Jean-Francois Pieronne
Browse files

secrules/rules15.py initial version

parent d9b23f5382c2
No related branches found
No related tags found
No related merge requests found
# -*- coding: iso-8859-1 -*-
from common import level_rule
import os
from secrules import FindFile
__version__ = '1.0'
@level_rule(1)
def rule1501(fo, fmt):
if not fmt:
print >>fo, 'RULE 1501'
print >>fo, '========='
with os.popen('TCPIP SHOW SERVICES') as p:
r = [x[:-1].rstrip() for x in p]
for l in r:
if (l == ''):
continue
if l[:7] == 'Service':
continue
s = l.split()
if s[0] in 'FINGER,FTP,RLOGIN,SNMP,TELNET,REXEC,RSH':
if s[5]=='0.0.0.0':
v = '%s %s' % (s[0], s[6])
else:
v = '%s %s' % (s[0], s[5])
if fmt:
print >>fo, '15011', v
else:
print >>fo, v
if __name__ == '__main__':
import sys
fo = open(sys.argv[1], 'w') if len(sys.argv) > 1 else sys.stdout
rule1501(fo, len(sys.argv) > 2)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment