script
This commit is contained in:
		
							parent
							
								
									5fbd54b715
								
							
						
					
					
						commit
						cc83aa49e2
					
				
							
								
								
									
										43459
									
								
								domains reader/malware.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43459
									
								
								domains reader/malware.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										22
									
								
								domains reader/reader.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								domains reader/reader.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| import re | ||||
| 
 | ||||
| print ('Domains Counter') | ||||
| 
 | ||||
| pattern = "[\w-]*\.\w{2,}$" | ||||
| domains ={} | ||||
| file = open("malware.txt", "r") | ||||
| for line in file: | ||||
|     result = re.search(pattern, line.strip()) | ||||
|     if (result):    | ||||
|         domain = result.group() | ||||
|         if (domain in domains): | ||||
|             domains[domain] = domains[domain] + 1 | ||||
|         else: | ||||
|             domains[domain] = 1 | ||||
|              | ||||
| file.close() | ||||
| 
 | ||||
| domains_sorted = sorted(domains.items(), key=lambda y:y[1]) | ||||
| 
 | ||||
| print (domains_sorted) | ||||
| 
 | ||||
| @ -1,2 +1,4 @@ | ||||
| facebook.com | ||||
| twitter.com | ||||
| twitter.com | ||||
| daraz.com | ||||
| omtrdc.net | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user