ImpostorKeanu / peasant

LinkedIn reconnaissance tool
48 stars 8 forks source link

Error Writing Output with Unicode Characters #4

Open st1ckyb1t opened 4 years ago

st1ckyb1t commented 4 years ago

There is an error being produced when writing unicode characters to CSV.

Command: python3 peasant.py h -c E:\Downloads\cookiebro-cookies.json --disable-logout -cns redacted -of redacted.csv

Output: [+] Starting new CSV file: redacted.csv [+] Authenticating session [+] Company Identifier for redacted: 339176 [+] Getting initial profiles [+] Available profiles: 156 [+] Extracting remaining profiles (this will take some time) [+] Done! Total known profiles: 117 [+] Writing output to redacted.csv Traceback (most recent call last): File "peasant.py", line 85, in harvest_contacts(args,session,main_profiles) File "C:\Users\relax\Tools\peasant\Peasant\harvest.py", line 79, in harvest_contacts writeProfiles(args.output_file,main_profiles) File "C:\Users\relax\Tools\peasant\Peasant\generic.py", line 112, in writeProfiles writer.writerow(p.to_row()) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2032.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-20: character maps to

st1ckyb1t commented 4 years ago

I discovered that changing line 106 in \Peasant\generic.py to the below will resolve the issue: csvfile = open(output_file,'w', encoding="utf-8")