Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing and "NET" (emails)
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chrisbrown




PostPosted: Tue Jan 25, 2011 7:23 pm   Post subject: Re: Turing and "NET" (emails)

First, instead of www.hotmail.com, you want to connect to smtp.live.com. That change should at least give you some response text to look at.

Second, local.domain probably means your ip address, but I don't know how significant it is.

Finally, this procedure might help you. Call it immediately after establishing a connection, as well as after sending each command.

Turing:

proc getAndPrintResponse (stream : int)
    var t := Time.Elapsed
    var c : char
    loop
        if Time.Elapsed - t > 5000 then
            put "Timeout waiting for response"
            return
        elsif Net.CharAvailable (stream) then
            loop
                if not Net.CharAvailable (stream) then
                    put ""
                    return
                end if
                get : stream, c
                put c..
            end loop
        end if
    end loop
end getAndPrintResponse



Also: You might have more luck using Google: smtp.gmail.com.
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Tue Jan 25, 2011 9:27 pm   Post subject: RE:Turing and "NET" (emails)

just times out constantly.... with both.
DemonWasp




PostPosted: Wed Jan 26, 2011 1:50 am   Post subject: RE:Turing and "NET" (emails)

I took a very brief look at this and got as far as asking for mail, which returns the server error message "530 Must issue a STARTTLS command first", which means that the server wants me to securely authenticate. This would require implementing TLS encryption (probably not impossible in Turing, just tedious and lengthy).

Turing:

% Wait until an entire line is available on the given stream, then read it into
% the given variable. Note the (optional) debug printing statement.
proc NET_RECV_LINE ( stream : int, var line : string )
    loop
        exit when Net.LineAvailable ( stream )
        delay ( 10 )    % avoid a strict busy-wait
    end loop
    get : stream, line : *
   
    put line
end NET_RECV_LINE


const SMTP_PORT : int := 25
const HOST : string := "smtp.gmail.com"
const HOST_ADDRESS : string := Net.HostAddressFromName ( HOST )

put "Connecting to "+HOST+" at "+HOST_ADDRESS
 
var stream : int := Net.OpenConnection ( HOST_ADDRESS, SMTP_PORT )
 
if stream <= 0 then
    put "Connection failed"
    return
end if

put "Connection succeeded"

var line : string := ""

NET_RECV_LINE ( stream, line )      % 220 mx.google.com ESMTP

put : stream, "HELO my.example.com"

NET_RECV_LINE ( stream, line )      % 250 mx.google.com at your service

put : stream, "MAIL FROM:<YourEmail@gmail.com>"

NET_RECV_LINE ( stream, line )      % 530 5.7.0 Must issue a STARTTLS command first.

chrisbrown




PostPosted: Wed Jan 26, 2011 2:59 am   Post subject: Re: RE:Turing and "NET" (emails)

DemonWasp @ Wed Jan 26, 2011 1:50 am wrote:
I took a very brief look at this and got as far as asking for mail, which returns the server error message "530 Must issue a STARTTLS command first", which means that the server wants me to securely authenticate.

If you send AUTH LOGIN after your HELO, you can submit Base64 credentials -- to Gmail, at least.
Turing:

proc flush (stream : int)
    var c : char
    loop
        exit when not Net.CharAvailable (stream)
        get : stream, c
        put c ..
    end loop
    put ""
end flush

proc printResponse (stream : int)
    var t := Time.Elapsed
    loop
        if Time.Elapsed - t > 5000 then
            put "Timeout waiting for response"
            return
        elsif Net.CharAvailable (stream) then
            flush (stream)
            return
        end if
    end loop
end printResponse

proc sendAndPrintResponse (stream : int, str : string)
    put str
    put : stream, str
    printResponse (stream)
end sendAndPrintResponse


const SMTP_PORT := 25
const SMTP_SERVER := "smtp.gmail.com"
const SMTP_ADDRESS := Net.HostAddressFromName (SMTP_SERVER)
const END_OF_BODY := "\r\n.\r\n"    %Don't change this

% You must have a valid Gmail account.
const UNAME_64 := "Gmail Username"  % Must be Base64-encoded. Here's an encoder:
const PWORD_64 := "Gmail Password"  % http://www.motobit.com/util/base64-decoder-encoder.asp

% Email Content
const MAIL_FROM := "Sender's email"
const SEND_TO := "Recipient's email"
const SUBJECT_TEXT := "Test Subject"
const BODY_TEXT := "Test Body"


setscreen ("text")


var stream := Net.OpenConnection (SMTP_ADDRESS, SMTP_PORT)
if stream > 0 then
    put "Connection established with ", SMTP_SERVER, " @ ", SMTP_ADDRESS
    printResponse (stream)
else
    put "Connection attempt timed out"
    return
end if


sendAndPrintResponse (stream, "EHLO " + Net.LocalName)

sendAndPrintResponse (stream, "AUTH LOGIN")

sendAndPrintResponse (stream, UNAME_64)

sendAndPrintResponse (stream, PWORD_64)

sendAndPrintResponse (stream, "MAIL FROM: " + "<" + MAIL_FROM + ">")

sendAndPrintResponse (stream, "RCPT TO: " + "<" + SEND_TO + ">")

sendAndPrintResponse (stream, "DATA")

sendAndPrintResponse (stream, "Subject:" + SUBJECT_TEXT + "\n" + BODY_TEXT + END_OF_BODY)

TokenHerbz




PostPosted: Wed Jan 26, 2011 6:21 am   Post subject: RE:Turing and "NET" (emails)

That seems to work better, i get replys from the servers.

I've tried to use hotmail (since i cant make Gmail account)

Im connecting to smtp.live.com port : 587 (25didnt work)

reply:
code:

Connection established with smtp.live.com @ 65.55.162.200
220 BLU0-SMTP191.blu0.hotmail.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at  Wed, 26 Jan 2011 03:12:10 -0800


"HELO local.domain" doesn't get a reply, which im reading it should. even (EHLO) doesn't (as printed above) .. iv'e increased response times to, the rest times out.

Iv'e used Base64 encryptions for my user/pass (and was attempting to send little data) to the same account. ( should be possible to send something to yourself, can do it in hotmail)

Any ideas? I don't think i have to set up any POP3 configurations since im not trying to access the client server right... So i'm at a loss, more tips please thank you.
2goto1




PostPosted: Wed Jan 26, 2011 7:57 am   Post subject: RE:Turing and "NET" (emails)

It sounds like hotmail may require that your SMTP connection is TLS/SSL based:

http://techblissonline.com/hotmail-pop3-and-smtp-settings/
TokenHerbz




PostPosted: Wed Jan 26, 2011 8:55 am   Post subject: RE:Turing and "NET" (emails)

even with that i still cant pass this crutch i'm stuck in. I've even been trying/reading about this stuff but i can't find anything on "How it works"...

I think for me to understand how it works or why it works would be a big help cause all this C and VB codes are useless unless i can understand it.

f u s t e r a t i n g Sad
TokenHerbz




PostPosted: Wed Jan 26, 2011 9:25 am   Post subject: RE:Turing and "NET" (emails)

WOW Awesome thanks to every one for the assistance, I HAVE IT WORKING!~!!!
Sponsor
Sponsor
Sponsor
sponsor
2goto1




PostPosted: Wed Jan 26, 2011 9:44 am   Post subject: RE:Turing and "NET" (emails)

Cool, what parts of the code are confusing?
ProgrammingFun




PostPosted: Wed Jan 26, 2011 11:36 am   Post subject: Re: RE:Turing and "NET" (emails)

TokenHerbz @ Wed Jan 26, 2011 9:25 am wrote:
WOW Awesome thanks to every one for the assistance, I HAVE IT WORKING!~!!!

So...are you going to post the whole code? Or perhaps an EXE? Razz
SNIPERDUDE




PostPosted: Wed Jan 26, 2011 4:53 pm   Post subject: Re: RE:Turing and "NET" (emails)

ProgrammingFun @ January 26th 2011, 11:36 am wrote:
TokenHerbz @ Wed Jan 26, 2011 9:25 am wrote:
WOW Awesome thanks to every one for the assistance, I HAVE IT WORKING!~!!!

So...are you going to post the whole code? Or perhaps an EXE? Razz


Second.
copthesaint




PostPosted: Fri Jan 28, 2011 10:13 am   Post subject: Re: Turing and "NET" (emails)

Im just going to say this now before you decide to post it,
think about all the people who go onto compsci...

now think about all the people who will take your evil code and use it to harras another student sending him 100's of emails a day.

now think of the dude sending the emails geting his account banned on hotmail or gmail *yes they do ban* Then the person comin back here and raging Very Happy

its best that the thing you post for this doesn't work Razz

Believe me when I say this can be an evil tool, facebook + freetime + evil code = nothing good Very Happy
DemonWasp




PostPosted: Fri Jan 28, 2011 10:25 am   Post subject: RE:Turing and "NET" (emails)

Any emails sent would be sent from your own gmail / hotmail address. I would hope that would be blindingly obvious.

Anyone with half a brain can already automate sending emails through command-line programs like sendmail anyway. His code manages nothing that a "real" email client couldn't do, save that you can script for it in Turing.

Besides, if your would-be victim can't find a way to deal with hundreds of spam emails coming from a single email address, they don't deserve to use email.

If you think this is exploitable, cop', then just wait until you find out about all the privacy / security issues Facebook has.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 28 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: