Replit, formerly Repl.it, is a San Francisco-based start-up and an online integrated development environment. Replit being Software as a service allows users to create online projects and write code in many supported languages.

Repls typically go to sleep after a period of inactivity (30 minutes after your website is visited). To make sure that your Repl is restarted, you can use our Always On functionality.

To add  Always On to your Repls, you will need to purchase Cycles or by subscribe to their plan.

https://docs.replit.com/

Registration for Free Plan

Free Personal Plan:

Free for all you need to get started.

FEATURES

  • Unlimited Repls
  • Free storage – 500 MB
  • Memory – 500 MB
  • vCPUs – 0.2 – 0.5 
  • Live multiplayer collaboration

LIMITATIONS

  • Your repl will sleep after about 30 minutes of inactivity, 

SOLUTION

REGISTRATION

  • URL: https://replit.com/
https://docs.replit.com/

Create Your First Repl 

You can choose a Blank Repl template to start:

You can get a shell to run your own commands:

Lets start with htop software. It will automatically install it then run it.

~/test$ htop
htop: command not installed, but was located via Nix.
Would you like to run htop from Nix and add it to your replit.nix file? [Yn]: Y
Adding htop to replit.nix
success
/nix/store/zkjmh1llrq0ssamd5lfxyz43s09vafhr-htop-3.0.5
Detected change in environment, reloading shell...
~/test$ 

Here is how the system looks like:

截屏2022-12-17 14.29.06.png
Your Repl project will be running in Google Cloud and the main host will be 8 cores wtih 64G RAM. All new REPL projects will be started from one server until it reaches the limitation, then start another new host server for new projects. As metnioned in previous section, free Repl will have 0.2-0.5 CPU, 512ram and 500MB storage. Need more, pay for it. 
By the way, although Replit provides SQLite database as well, for your dynamic site, it had better to use other site’s free database, such as https://freedb.tech/ , which gives you a free 50MB MySQL db with root access. 

Steps to create your first Python App

Document Website: https://docs.replit.com/
https://replit.com/

Homepage: https://replit.com/

Demo Sites:
⚡https://myip.51sec.org/
⚡https://whatsmyip.51sec.org/

1 Log into replit site.

2 From Home page, click +Create button to create your own Repl. Choose Python as templete.

3 Type following code into main.py code section

Code can be found from Github site:  https://github.com/51sec/myip/blob/main/main.py

from replit import web
import flask
from flask import Flask, request

app = flask.Flask(__name__) 
  
@app.route("/") 
def home_view():
  
        ip_addr1 = request.remote_addr
        ip_addr2 = request.environ['REMOTE_ADDR']
        ip_addr3 = request.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)
        return "</BR>" +"</BR>" +"</BR>" +"<h1>Welcome to My PY website!</h1>"+"</BR>" + "<h1> Your IP address is:" + ip_addr1 +"</BR>" + "<h1> Your IP address is:" + ip_addr2 + "</BR>" + "<h1> Your IP address is:" + ip_addr3

web.run(app)

4 Click green Run button to start to run it

You will get a url from right panel Webview:

Using UptimeRobot Site to Keep it Awake

If you Repl website is not visited in 30 minutes, it will be put into sleep mode. then you will have to go to home page again to wake it up.

Here is a simple way to keep it awake. You can create a monitor in UptimeRobot site  and use http(s) monitor to visit it every 25 minutes to keep it awake. 

Here is an example when UptimeRobot visit the site every 10 minutes or any minutes less than 30 minutes 

 * Serving Flask app 'main'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:8080
 * Running on http://172.31.128.114:8080
Press CTRL+C to quit
172.31.128.1 - - [30/Jan/2023 17:11:49] "GET / HTTP/1.1" 200 -
172.31.128.1 - - [30/Jan/2023 17:15:27] "GET / HTTP/1.1" 200 -
172.31.128.1 - - [30/Jan/2023 17:15:54] "HEAD / HTTP/1.1" 200 -
172.31.128.1 - - [30/Jan/2023 17:25:54] "HEAD / HTTP/1.1" 200 -
172.31.128.1 - - [30/Jan/2023 17:35:54] "HEAD / HTTP/1.1" 200 -
172.31.128.1 - - [30/Jan/2023 17:45:54] "HEAD / HTTP/1.1" 200 -
172.31.128.1 - - [30/Jan/2023 17:55:54] "HEAD / HTTP/1.1" 200 -

Get Root Permission

 

1 Create a Repl using Bash template
截屏2022-12-24 08.03.11.png

2 Execute following commands from right panel’s Console window, not Shell

wget https://cdn.discordapp.com/attachments/853535040250970113/878590395611775016/yt.zip (Press enter)
unzip yt.zip (Press enter)
unzip root.zip
tar -xvf root.tar.xz
./dist/proot -S . /bin/bash

3 Once all  those commands done, you will be root.

截屏2022-12-24 08.03.24.png

Create Repl for v2ray, trojan

 V2RAY

  1. 浏览器登录自己的Replit账号,新窗口打开https://replit.com/@wanghanzhe/V2RAY?v=1
  2. 备用地址: https://replit.com/@oracleservice/V2RAY
  3. fork这个项目,仅需点击Use Template,然后给项目取个名字,然后Use Template就行了。
  4. 点击run,Console会输出password和url,直接添加到app中即可使用;
  5. 截屏2022-12-17 15.50.26.png
  6. 速度如何呀? 谷歌的服务器不用问,电脑上我都没测试,直接告诉你能跑满,而且现在用的人也不太多,白嫖党作为自己的主力线路好像也没压力。

TROJAN

  1. 非常简单,Fork https://replit.com/@sos801107/trojan?v=1
  2. 备用地址: https://replit.com/@oracleservice/trojan
  3. 然后运行 bash main.sh
  4. 即可看到 trojan链接和二维码,实测路由器可用。

Using Your Own Domain

Domain Linking – DNS A record or CNAME, with TXT record.

Click the Edit icon beside your repl.co domain, you will be able to enter your own custom domain in it.

Once you enter a valid domain name, you will be prompted to for step 2 to add a CNAME record and also TXT record to do verification. 

I am usually using Cloudflare to manage all of my domains, you will be able to easily add those two records in.  This is the screenshot for one of my Python page whatsmyip.51sec.org. 

After both records added into your DNS manager site, you can click “Link domain” button to link your custom domain to your Repl application. It might need a couple of minutes to get verification part done. But eventually, you will get it linked. 

Demo: https://whatsmyip.51sec.org

Share Your Project with Others

Another nice thing Repl has is you are able to invite others to work with you together for you app, which brings social feature and colloaboration feature into this website. 

Some Interesting Repl Templates

 

  • Free Broswer in Replit – https://replit.com/@York618/Nonepe

Videos

 

References

By netsec

Leave a Reply