1
I'm sending some emails using SMTP and CURL over TOR but i have an issue: i receive some chinese characters over the ones i should receive, any idea?
This is how i send the mail using a batch script (i have a file variable):
curl.exe --socks5-hostname 127.0.0.1:9050 smtp://onionaddre.onion:port --mail-from mail@onionaddr.onion --mail-rcpt mail@onionaddr.onion --user mail@onionaddr.onion:password --upload-file %filetosend%
This is the original message:
0asf345£%$&fdasdhhs#@deadfga
This is what i get:
聣聭聤聭聯聶聥耠職聮聯職耠職聩聢聴聹耠聣聬聩耍耛聳聢耍聲
I don’t really understand what you’re doing here. But when you see behavior like that it is usually an encoding mismatch. How are you encoding the data and what does the recipient expect? Unicode/Base64/ASCII, etc. – Appleoddity – 2018-03-23T12:33:31.680
I have no clue. Basically i have a powershell program that generate characters according to time and date (like an encryption key) and then i need to send this key over tor. I don't know what encoding is used, how do i verify that? The TOR mail server i'm using is TorBox with SquirrelMail 1.4.22 – zipomojiv – 2018-03-23T12:40:14.433
You can force Powershell to encode the text to UTF8 by doing this:
$UTF8 = [System.Text.Encoding]::UTF8
$Message = "blah"
$UTF8Message = $UTF8.GetBytes($Message)
– shinjijai – 2018-03-23T15:54:27.823@shinjijai this should be added in the powershell code that generates the file right? – zipomojiv – 2018-03-23T15:59:40.467
If you're using Powershell to generate the file, you can save the file as UTF8 by using the
-Encoding
parameter and specifyingUTF8
. For exampleOut-File -Path "file.ext" -Encoding "UTF8"
. IF you are loading the file in with another Powershell script usingGet-Content
, remember to use-Encoding "UTF8"
there as well.But since you're using--upload-file
, the file being saved withUTF8
should suffice. I hope that make sense. – shinjijai – 2018-03-23T16:04:18.613@shinjijai to generate the file save path i use: 'function Start-EncKey($path="$env:enc.key")' ( later i move this enc.key to mail.txt with cmd move command), so i should change it to: 'function Start-EncKey($path="$env:enc.key") -Encoding "UTF8"' right? – zipomojiv – 2018-03-23T16:10:56.490
@shinjijai even if later i already have: ' if ($success) { [System.IO.File]::AppendAllText($Path, $myvalue, [System.Text.Encoding]::Unicode) ' – zipomojiv – 2018-03-23T16:12:16.847
1Change the
[System.Text.Encoding]::Unicode
to[System.Text.Encoding]::UTF8
. I think that's your issue, the file is unicode and cURL might be posting as UTF8, I don't know off-hand what the defaults are for cURL. – shinjijai – 2018-03-23T16:14:38.350Perfect, it works! Add it to the answers so i can accept it – zipomojiv – 2018-03-23T17:27:00.400