def analyze(): f = open('data.json', 'r') j = f.read() f.close() if not j: print 'read file error' return data = json.loads(j) manual_data.add_manual_data(data) for k, v in data.items(): if 'ga' in v: ga = v['ga'] for ua in ga: ua = ua[:11] if ua not in manual_data.checked: print ua ga = {} ym = {} res = {} for k, v in data.items(): if 'whois' in v: for kk, vv in v['whois']: if ('privacyprotect.org' not in vv) and \ ('*****@*****.**' not in vv) and \ ('*****@*****.**' not in vv) and \ ('*****@*****.**' not in vv) and \ ('publicdomainregistry.com' not in vv) and \ ('@' in vv): print '!!!!!!!', k, kk, vv #if v['whois'].get('e-mail'): #print '!!!!!!!', v['whois'].get('e-mail') if type(v) != dict: continue ga_ids = v.get('ga', []) ym_ids = v.get('ym', []) for ua in ga_ids: #print '\t', ua ua = ua[:11] if not res.get(ua): res[ua] = set() res[ua].add(k) #for ua in ym_ids: ##print '\t', ua #if not res.get(ua): #res[ua] = set() #res[ua].add(k) for k, v in res.items(): if len(v) > 1: print k for url in v: print '\t', url
def draw(): f = open("data.json", "r") j = f.read() f.close() if not j: print "read file error" return data = json.loads(j) add_manual_data(data) cut_ga(data) graph = nx.Graph() nodes = {} edges = [] ga_pix = QPixmap("google.png") ym_pix = QPixmap("yandex.png") email_pix = QPixmap("email.png") site_pix = QPixmap("site.png") for url, info in data.items(): if info.get("err"): continue for id_ in info.get("ga", []): id_ = id_[:11] if id_count(id_, data) > 1: graph.add_edge(url, id_) edges.append([url, id_]) nodes[id_] = QGraphicsPixmapItem(ga_pix) nodes[id_].name = id_ nodes[id_].setFlag(QGraphicsItem.ItemIsMovable, True) for id_ in info.get("ym", []): id_ = id_[:11] if id_count(id_, data) > 1: graph.add_edge(url, id_) edges.append([url, id_]) nodes[id_] = QGraphicsPixmapItem(ym_pix) nodes[id_].name = id_ nodes[id_].setFlag(QGraphicsItem.ItemIsMovable, True) if info.get("email"): email = info.get("email") nodes[email] = QGraphicsPixmapItem(email_pix) nodes[email].name = email nodes[email].setFlag(QGraphicsItem.ItemIsMovable, True) graph.add_edge(url, email) edges.append([url, email]) nodes[url] = QGraphicsPixmapItem(site_pix) nodes[url].name = url nodes[url].setFlag(QGraphicsItem.ItemIsMovable, True) graph.add_node(url) for key, data in nx.graphviz_layout(graph).items(): x, y = map(lambda x: x * 1.5, data) if key in nodes: nodes[key].setPos(QPointF(x, y)) nodes[key].lol = key return nodes, edges