zhengxin0617 / welly

Automatically exported from code.google.com/p/welly
GNU General Public License v2.0
0 stars 0 forks source link

auto-login doesn't work for some BBS; here is a solution ;) #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi,

I'm using Welly svn revision 418, and trying the new auto-login feature.  It 
works fine with PTT, 
but doesn't work with some BBS sites.  These sites have one thing in common: 
the "telnet 
connecting" screen would be displayed for 1 second before the "login" screen 
(an example is in 
the attachment).

Here I found a solution:

In YLConnection.m -> login() function:

            if (ps != pe) {
                sleep(5);
                [self sendBytes:ps+1 length:pe-ps-1];
                [self sendBytes:"\r" length:1];
            }

change the period of sleep() longer, say, 3 seconds.  I've tried using 
"sleep(2)" and the auto-
login works with those sites that displays connecting screen before login 
screen.

But I think that, sending the ID and Password as the first two strings in the 
beginning of 
session, is not so good :(

Take OpenPCMan (a BBS client on Windows which is popular in Taiwan) for 
example, there's a 
"auto-reply by trigger" feature.  The user just tell PCMan: "when you see a 
specific string 
appeared in the same line of cursor position, send a string to the telnet 
remote".  For example, 
"when you see '[username]' in the same line of cursor position, just send 
'myid'; and if  you see 
'[password]', you send 'mypasswd'."

The auto-reply could be an only-once event, i.e. once the event happens, it 
wouldn't happen 
again, in this session, to avoid that someone is putting a specific string on 
the screen that 
would make PCMan to send one's password accidently.  Take a look (and also it's 
source code) 
at http://pcman.openfoundry.org/

Thanks for your participation in Welly, and happy Chinese new year :)

Original issue reported on code.google.com by duckste...@gmail.com on 22 Jan 2009 at 2:30

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks a lot :) tangyang is now working on this issue:) 

Original comment by lvli...@gmail.com on 23 Jan 2009 at 3:00

GoogleCodeExporter commented 9 years ago
hi,

Thanks a lot for your using Welly and your kind suggestion.

In fact, what you said is exactly what we had thought about before. However, 
the prompt of '[username]' varies 
from site to site, e.g., some are '[username]', some are 'username:' and some 
others are even more amazing. 
It's too hard to enumerate them all, thus we come to this brute force. We are 
hoping to implement the "auto-
reply by trigger" feature where the triggers can be user-defined, maybe in the 
next version. It sounds really 
cool.

At present, we are simply meeting the needs of those who are eager for the 
auto-login feature. What we have 
been focusing in this version is the use of the Keychain Service. As for this 
issue, we strongly encourage you 
to use SSH connections instead of telnet whenever possible. SSH doesn't have 
this problem, and is much more 
secure for your password. (For telnet connections, even if the password is not 
echoed on the screen, it is 
transferred via the Internet without any encryption.)

Nevertheless, we are using the following workaround for telnet connections. 
Basically, it's based on adjusting 
the sleep() time. However, setting it to 1 second is not enough for some sites, 
while setting it to 2 or more 
seconds may seems too lag. As a workaround, we are examining the cursor 
position to decide whether we 
should sleep another second. Since the login prompt on all (at least as far as 
I know) sites are on the lower-
half of the screen, we check if the cursor is on the top 4 lines, sleeping 
another second if so, until the cursor 
jumps down. I think it will solve this problem.

Please check out the latest revision on the svn and send us feedback if 
possible. Thank you very much. Wish 
you a happy Chinese new year!

Original comment by tangyang...@gmail.com on 23 Jan 2009 at 3:19

GoogleCodeExporter commented 9 years ago

Original comment by lvli...@gmail.com on 2 Mar 2009 at 4:26