Use intranet cloud + GitHub Pages to deploy dynamic websites for free

Table of contents

1. Failure experience

1. Peanut shells

2. nat123

3. Cloud wear

4. cpolar

5. snoring

6. Jinwanwei quick analysis

7. Shenzhuo Internet

8. Intranet cloud (neiwangyun.net)

9.localhost.run

10.GitHub Pages(pages.github.com)

11.IPv6

12.IPv6+GitHub Pages

13.FRP

14.nps

2. The ultimate solution: Intranet cloud + GitHub Pages


1. Failure experience

I believe many people want to build a website. However, building a website requires not only accessing it yourself, but also allowing others to access it.

However, the devices in our homes are generally deep inside the internal network and cannot be accessed from the external network.

Therefore, many people will look for various "intranet penetration" software on the Internet and try it, but none of them can do what they want.

I'm the same way. Next, I'll share with you my failed attempts.

1. Peanut shells

Recommended by many people online. After installing it, I found that almost all functions are charged. Just give up.

2. nat123

It says it's free, but it's very slow. The key is that once I made a wrong configuration and wanted to change it, it told me what N coins I needed and how I could get them. Answer: Spend money! I just realized that this software is a lie when it says it is free! Give up decisively.

3. Cloud wear

Oh my god, I can’t even register an account, I get an Unknown error (-1), and the login page refreshes endlessly. give up.

4. cpolar

It said it was very stable and I wanted to try it. As a result, it told me that the domain name changes every 24 hours! What is the use of such a website!

5. snoring

Same as cpolar.

6. Jinwanwei quick analysis

Been using it for a month, good! Ability to customize second-level subdomain names! (Happy) As a result, one day I suddenly couldn’t access it (see this Q&A for details ), and then I gave up. Too unstable!

7. Shenzhuo Internet

Just like peanut shells.

8. Intranet cloud ( neiwangyun.net )

It's very simple, just SSH. However, custom second-level subdomain names are not supported.

9.localhost.run

Same as intranet cloud.

(Regarding the intranet cloud and localhost.run, I posted a Q&A , thank you for your answers.)

10.GitHub Pages(pages.github.com

Only static websites can be deployed.

 give up give up.

11.IPv6

It is said that China Mobile has assigned us all IPv6 public IP addresses. I am so happy!

Unfortunately, the IP assigned by Mobile is dynamic.

 etc! Didn’t I talk about GitHub Pages earlier? ! !

12.IPv6+GitHub Pages

I wrote a program to continuously push the IPv6 public IP to the GitHub repository, and then enabled the GitHub Pages service for the GitHub repository. Then as long as you access GitHub Pages, the IP will be automatically queried and then jumped to this IP. (For specific source code, please refer to https://github.com/bjsdfz17ban/webddns )

I checked and found that my IPv6 IP starts with 2409. The Internet told me that it is a public IP. I visited and it was no problem.

(great joy)

……

Until one day, I made a game for my classmates to play.

Student A: Why can’t I access your website?

I:? Is it your problem?

Classmate B: I can’t access it either.

I:? ? ? Try changing your browser

Student A: It doesn’t work even if I change the browser.

I:

Confused

Confused

Confused

ten face dumbfounded

dumbfounded

Confused

Billions of confused faces

The public IP cannot be accessed yet! ! ! Impressed! ! !

13.FRP

Many people recommended it, but it turned out that it said it needed a server with a public IP! ! ! I'm convinced, I have a public IP, and I can penetrate it with a hammer! ! !

 (Picture source: https://zhuanlan.zhihu.com/p/437319496 )

14.nps

Same FRP.

2. The ultimate solution: Intranet cloud + GitHub Pages

I began to carefully recall the failed plans...

Suddenly, I remembered those intranet penetration software whose domain name changed randomly. Isn't this the same as the dynamic IP of IPv6? Since IPv6 dynamic IP can be solved with GitHub Pages, so can dynamic domain name! ! ! !

So, I quickly determined a general idea: find those intranet penetration software (cpolar, intranet cloud...) that are very stable and have no restrictions, but whose domain names change randomly, and then write a program to crack their clients and obtain Go to that domain name, save it in a file, finally push the file to GitHub, and then deploy GitHub Pages. Then, deploy the static web page as usual with GitHub Pages. On the surface, it looks like a static page, but if a web page wants to access the backend, it only needs to query the file to obtain the domain name of the backend. Then send an ajax request to the background to interact with the background. (It’s okay if you don’t understand, there will be a more detailed explanation next)

In the end, I chose "Intranet Cloud" as the final intranet penetration software. Because the "Intranet Cloud" uses SSH as the client, it is easier to crack the randomly changing domain name.

The specific deployment process is as follows:

  • 1. Create a repository on GitHub.
  • 2. Deploy GitHub Pages to the warehouse.
  • 3. Start SSH, connect to the intranet cloud server, and redirect the output to file A (the SSH output contains the random domain name).
  • 4. Through C language, find the random domain name in file A (the implementation details are omitted), and output it to another file B.
  • 5. Push file B to the GitHub repository.
  • 6. Repeat steps 3 to 5 on the backend server.
  • 7. Write a static web page (HTML).
  • 8. Whenever this webpage needs to interact with the background, it reads the contents of file B (through ajax).
  • 9. After obtaining the domain name of the backend, you can interact with the backend (still use ajax).
  • 10. Push the web page to the GitHub repository.

In this way, you can deploy a dynamic website for free and achieve external network access without spending a penny.

If there is anything you don’t understand, please feel free to communicate in the comment area!

3. Code implementation

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
char cmd0[4096],cmd1[4096],cmd2[4096];
char tmp0[4096];
int main(int argc,char **argv){
    if (argc != 6){
        printf("Usage: openlpl <http|https|ipport> <port> <file> <remote> <git-branch>\n");
        printf("Example: openlpl https 80 80.txt origin master\n");
        return 0;
    }
    char *mode = argv[1];
    char *port = argv[2];
    char *dir = ".";
    char *file = argv[3];
    char *rem = argv[4];
    char *br = argv[5];
    sprintf(tmp0,"cd %s",dir);
    system(tmp0);
    sprintf(cmd0,"ssh -R 80:localhost:%s [email protected] > .%s.tmp 2> /dev/null",port,file);
    sprintf(cmd1,"cat .%s.tmp | grep %s | grep -v tunnel | awk '{print $3}' > %s",file,mode,file);
    sprintf(cmd2,"git add . && git commit -m \"changed domain\" && git push %s %s",rem,br);
    while (1){
        if (fork() == 0){
            system(cmd0);
            return 0;
        }
        sleep(5);
        system(cmd1);
        system(cmd2);
        wait(NULL);
    }
    return 0;
}

Store this file as openlpl.c (OpenLPL: Open Local Port Locating, open source local port locating service)

Then compile:

gcc openlpl.c -o openlpl

run:

./openlpl <协议类型 http|https|ipport> <端口> <存放域名的文件> <仓库地址> <仓库分支>

For example:

./openlpl https 80 80.txt [email protected]:name/repo.git master

This code will penetrate port 80 to the external network and continuously push the generated random address to the master branch of [email protected]:name/repo.git.

Guess you like

Origin blog.csdn.net/nnKevi/article/details/128822955