import csv
import pandas as pd
import socket
from urllib.parse import urlparse
contents = []
df = pd.read_csv('new-bad-urls.csv')

file = open("data.txt", "w")
fileIp = open("IPaddress.txt", "w")
filePath = open("pathKeyword.txt", "w")
with open('new-bad-urls.csv', 'r+') as filehandle:
	df = pd.read_csv('new-bad-urls.csv')
	for line in filehandle:
		o = urlparse(line)
		
		print(o)
		print(o.netloc)
		print(o.path)
		#print(socket.gethostbyname(o.netloc))
		#s = pd.Series(socket.gethostbyname(o.netloc))
		#print(s)
		#df['IP'] = socket.gethostbyname(o.netloc)
		#df['Keywords'] = ((o.path).split("/"))
		#print(df['keywords'])
		#filePath.write(o.path)
		#fileIp.write(o.netloc)
		file.write(o.path)
		file.write(o.netloc)
	
	df.to_csv('new-bad-urls.csv', sep=',', index = False)