Archive for the ‘hacking’ Category

ssh :: slow login

Wednesday, May 4th, 2005

Problem :
While using ssh to connect to a system, it takes long time ( about 20 secs in 100 mbps LAN) to login. Though the connection after loggin in quite perfect (realtime).

I had a similar problem with research server.

ssh -v -v -v smr@research… shows the delay after following line
debug1: SSH2_MSG_SERVICE_REQUEST sent

Solution :
* Make sure that the problem is not with DNS lookup etc
* PermitEmptyPasswords no [ disable Empty Passwords it in sshd_config]

After trying bruteforce on /etc/hosts , sshd_config i finally got it. Google didnt help me with the problem, though found the thread at many places, but none of them had the solution.

IIIT::blogroll updated with feeds

Friday, April 8th, 2005

shows the recent post now for every blog. Blog reading made easy.
it looks great now smile link

thanks to Feed2JS and Magpie to make it possible.
It reads a feed (rss/atom), parses it and displays it. Really great work by the developers.

There is another simpler script called zFeeder but it doesnot support atom feed.

TODO : sort blogs by recent post

php_sessions_test

Wednesday, March 30th, 2005

How to make sessions work in php ?
Tried to make a generic/foolproof script.
Really very easy with php. Have a look.

index.php
<?php include(’header.php’); include(’login_form.php’); include(’footer.php’); ?>
login_form.php
<br><form action=validate.php method=post> Loginid : <input type=text name=login><br> Passwd : <input type=password name=pass><br><br> <input type=submit name=submit value=login></form><br>
validate.php
<?php if( isset( $_POST[’submit’] ) ) { if( $_POST[’login’] == “guest” and $_POST[’pass’] == “iiit123″ ){ //<!–Yes… you are a real iiitian. You can proceed –> session_start(); $_SESSION[’loginname’] = “guest”; header(”Location: main.php”); }else{ ?> No…. you are not an iiitian. Login as an iiitian<br> <?php include(’login_form.php’); }}else{ include(’header.php’); ?> You must login before. <br> <?php include(’login_form.php’); include(’footer.php’); } ?>
main.php
<?php session_start();if( !isset( $_SESSION[’loginname’] ) ){ include(’header.php’); ?> You are not logged on.<br> Login first <br> <?php include(’login_form.php’); include(’footer.php’); }else{ include(’header.php’); session_start(); ?> Hi <b><?php print $_SESSION[’loginname’]; ?></b> you are welcome<br> <!– menu follows –> <a href=logout.php>Logout</a><br> <?php include(’footer.php’); } ?>
logout.php
<?php include(’header.php’); session_Start(); if(isset($_SESSION[’loginname’]) ) { $_SESSION[’loginname’] = “”; session_destroy(); ?> Logged out successfully <br> <?php } include(’login_form.php’); include(’footer.php’);?>
header.php
<html><head><title>php_session_test</title></head><body>
footer.php
<!– (c) 2005 smr –></body></html>

its running (for few days only) on http://students.iiit.ac.in/~smr/pst/.
Have a look, try to hack. Comments/Suggestions are welcome.
php rocks. just suck at one point. why not run with user permission ?
Okey fine security issues, but sometime it sucks.

BlogThis for firefox

Wednesday, March 23rd, 2005

Tarun was looking for some BlogThis firefox extension, to post a new blog to blosxom. ( Tarun going to enter the blogworld, with blogThis-ed posts only, for all the things he is reading, and making a collection of it with comments etc ).
I had the idea that a the extention will send the data to some cgi/php where you can create a post out of that. But while searching for an extention, I got the hint to use a simple javascript to do the job. So I binded the javascript with a mouse gesture (with the help of Mouse Gestures 1.0 extension).

Q=”;
x=parent.content.document;
y=window;
if(x.getSelection){
Q=x.getSelection();
}else if(y.getSelection){
Q=y.getSelection();
}
void(window.open(’http://students.iiit.net/~smr/test.php? title=’+ escape(parent.content.document.title)+ ‘&select=’+escape(Q)+’ &url=’+ escape(parent.content.location.href),’blogThis’,’ scrollbars=no,width=475,height=300,top=175,left=75, status=yes,resizable=yes’));

It sends the url, title and selected text to a cgi/php, which can create a post of that.

That was my first javascript code. hmmm its easy and good.