Skip to content

Instantly share code, notes, and snippets.

@jackyshan
Created July 6, 2017 12:51
Show Gist options
  • Save jackyshan/b587daac8ae90e445cb9f43914f49f7b to your computer and use it in GitHub Desktop.
Save jackyshan/b587daac8ae90e445cb9f43914f49f7b to your computer and use it in GitHub Desktop.
检查ss客户端ip地址
# -*- coding: utf-8 -*-
import re
file = open('shadowsocks.log')
list = file.readlines()
file.close()
pattern = re.compile(r'INFO.+(\d+\.){3}\d+')
clists = []
for index in range(700000, len(list)):
info = list[index]
m = pattern.search(info)
if m:
m = m.group()
pp = re.compile(r'from (\d+\.){3}\d+')
m = pp.search(m)
if m:
m = m.group()
try:
clists.index(m)
except:
print info
clists.append(m)
#print clists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment