The development of technology is getting faster and faster, and mobile phones are being replaced more and more frequently. Many old mobile phones are obsolete. These old mobile phones are generally useless and cannot be sold. After all, there may be some private data in the mobile phone that may not be emptied. Therefore, these old mobile phones can only be left in the house and fall into dust.
For most people, these old mobile phones cannot be used. Although there are many tutorials on using old mobile phones on the Internet, many of them are either very tasteless or difficult to operate and require strong hands-on ability.
So today, I will teach you howto quickly and cheaply turn an old Android phone into a remote-accessible camera.
Building a LAN camera requires a software, that is ip-webcam. Users who can access the Google store can directly search for "ip-webcam" in the store and download it. For users who cannot access, they can go to https://www.appsapk.com /ip-webcam/ to download.
Since we will put this camera on the public network later, we need to set an account password, otherwise it will be very insecure. But if you only need to use it in the LAN, the account password can be left blank.
After configuring the account password, other content can be adjusted according to your own needs. It should be noted that if the upstream bandwidth of the home network is relatively low, you can appropriately lower the video resolution and frame rate, otherwise you can access it on the external network. always freezes.
After the setting is complete, turn to the last one and click to start the server directly.
After the service is turned on, the video connection address will be displayed on the interface. Enter the address on any computer or mobile phone in the current network to access the camera, and click the browser option to view the video content.
It can be seen that in addition to viewing video, it has many functions, such as: motion detection (automatic capture), switching flash, loop recording, etc.
There are more advanced functions, such as cooperating with tasker to develop more functions, you can discover by yourself.
If you use a mobile phone as a camera, you need to pay attention to the problem of heat generation. Due to design problems of some mobile phones, the long-term opening of the camera will cause the mobile phone to heat up seriously. If it heats up for a long time, the device may be damaged. As for whether your device is suitable for use as a camera, you can test it yourself. In other words, it can be used as a camera that is always on if it runs for more than one or two hours at room temperature without shutting down due to overheating. However, you still need to be careful not to place it in a place where the temperature is too high or in direct sunlight.
If it is always on, it should be placed near the power supply, or buy a longer data cable to charge it.
The camera turned on above can only be used in the local area network. If you need to use it in the public network, it will be a little more troublesome. If the broadband you handle has a static public IP, you can set up port mapping on the router to access it on the external network.
However, most of the broadband users handle are dynamic public network IPs or shared public network IPs, so setting port mapping will not work, so some other solutions need to be considered.
If you don't want to spend money, you can directly search for dynamic domain name resolution and intranet penetration to find related software. There are many commercial software that can be used. These commercial software have detailed instructions for use, so I won't repeat them. If you need it, you can search for the use plan by yourself. For users with less hands-on ability or less demand, you can directly register and use the free plan., is relatively easy to install.
However, there are generally many restrictions for free, such as traffic restrictions, mapping number restrictions, domain name restrictions, etc. Also, real-name authentication is generally required. Therefore, after trying this solution for a period of time, I felt very uncomfortable, so I gave up.
(Because the shooting location of home cameras may involve privacy areas, individuals do not trust some commercial cameras to directly upload unencrypted video data to the company's server. In addition, many commercial cameras are installed in order to facilitate remote debugging and installation. There are certain remote control solutions. I believe that employees of commercial companies will not view video information privately, but this method will leave opportunities for some malicious hackers, so I built a set of services myself.)
The solution I use requires a public network server as a proxy, because the server does not carry the main computing services, but only does traffic forwarding, so it does not require high performance and does not require a lot of storage space.
The most important thing is that a service can do many things, including but not limited to the following things: private cloud disk, personal website, Git repository, proxy service, game server, download service, crawler.
A lot of messy things have been said above, let's talk about the principle of this scheme first:
The principle is actually very simple. It is a reverse proxy service. Using a public network proxy server (proxy-server) as a springboard, the server can be accessed from any location on the public network. After that, the server will forward the received information to the corresponding The proxy client (peoxy-client), the proxy client accesses the service on the intranet. After the intranet service responds, it is passed back according to the opposite path, and finally the service can be accessed from any location to the intranet. The schematic diagram is as follows:
I found an open source reverse proxy tool on GitHub, this tool has a packaged version, and the deployment is very simple, it is lanproxy.
GitHub address: https://github.com/ffay/lanproxy
Lanproxy is an intranet penetration tool that proxy LAN personal computers and servers to the public network. Currently, it only supports tcp traffic forwarding, and can support any tcp upper-layer protocol (access to intranet websites, local payment interface debugging, ssh access, remote desktop. ). To use a third-party public network server, you must pay for the third-party, and these services have various restrictions. In addition, because the data packets will flow through the third-party, it is also a big hidden danger to data security.
Go to https://seafile.io2c.com/d/3b1b44fee5f74992bb17/ to download the packaged server and client.
I use the CentOS 7.4 system myself, so I will introduce this system as a benchmark. Of course, other systems are also supported (including various Linux and WIndows).
It should be noted here that you need to be familiar with some basic Linux-related commands, assuming that everyone knows a little basic Linux commands.
If you are familiar with text editing commands such as vi (vim), you can directly upload the original server-side compressed package to the service. After decompressing, you can edit the configuration file (proxy-server-20171116/conf/config.propertoes) with these commands.
If you are not familiar with the commands related to text editing on Linux, you can unzip it on your computer now, find the corresponding configuration file (proxy-server-20171116/conf/config.propertoes) to edit it, and then compress it again and upload it to the server.
The default configuration file is as follows:
server.bind=0.0.0.0 server.port=4900 server.ssl.enable=true server.ssl.bind=0.0.0.0 server.ssl.port=4993 server.ssl.jksPath=test.jks server.ssl.keyStorePassword=123456 server.ssl.keyManagerPassword=123456 server.ssl.needsClientAuth=false config.server.bind=0.0.0.0 config.server.port=8090 config.admin.username=admin config.admin.password=admin
Note: Modify the username and password fields.
Then upload the server to the server through the scp command:
scp local_file remote_username@remote_ip:remote_folder # For example scp lanproxy-server-20171116.zip email@example.com:/home/lanproxy
Use the ssh command to log in to the server, you can log in directly on the web page, and other servers can use the ssh command to log in.
# Log in to the server ssh root@ip # Enter the password. The password is obtained from the platform where the server was purchased. No characters will be displayed when entering the password. Just click the Enter key after the input is complete.
If there is no zip software decompression tool on your service, you can install it with the following command:
yum install zip unzip
In addition to these tools, you also need to install the java runtime environment, just install openjdk directly, either version 1.7 or 1.8.
yum install java-1.7.0-openjdk.x86_64
After the installation is complete, unzip the software:
Go to the bin directory in the unzipped folder and execute the startup command:
If the startup is successful, it will show a pid like:
./startup.sh Starting the proxy server.started PID: 19875
At this point, the service is officially started, and the subsequent content can be set on the webpage, and you can see the management page by visiting http://IP:8090 (IP is the public IP of the server).
PS: If you can't access it, please check if you can ping the port, the server's firewall and security group rules.
The landing page is as follows:
Log in with the previously configured username and password. After logging in, add a client, as follows, write the name as you like, and use the randomly generated key.
After that, you will see that there is an entry G-IPCam in the configuration management, click this entry and then click Add Configuration to add port mapping (add a camera mapping, and the back-end proxy information will fill in the IP address displayed on the camera before):
After clicking submit, a mapping data is added.
To set the security group configuration to open port 8080, if it is a server of other platforms, you need to set up a firewall to open the port. The specific setting method needs to be set according to the server system type, you can search by yourself.
The following paragraph is taken from the lanproxy documentation.
So far, the server has been built. As long as the client is successfully connected, it can be accessed through the Internet. Install the client (client) on any computer host in the local area network where the mobile phone is located. In the release package downloaded above, there are Java-based cross-platform client, the configuration is as follows:
The configuration file of the Java client is placed in the conf directory, configure config.properties
#Consistent with the secret key filled in when creating the client in the proxy-server configuration background; client.key= ssl.enable=true ssl.jksPath=test.jks ssl.keyStorePassword=123456 #Fill in the actual proxy-server address here; there is no server by default, and if you have your own server, replace it with your own proxy-server (IP) address server.host=lp.thingsglobal.org #proxy-server ssl default port 4993, default normal port 4900 #ssl.enable=true, fill in the ssl port here, when ssl.enable=false, fill in the ordinary port server.port=4993
If you do not want to install the Java environment, you can directly run the client compiled by the platform.
# mac 64bit nohup./client_darwin_amd64 -s SERVER_IP -p SERVER_PORT -k CLIENT_KEY & # linux 64bit nohup./client_linux_amd64 -s SERVER_IP -p SERVER_PORT -k CLIENT_KEY & # windows 64 bit./client_windows_amd64.exe -s SERVER_IP -p SERVER_PORT -k CLIENT_KEY
# mac 64bit nohup./client_darwin_amd64 -s SERVER_IP -p SERVER_SSL_PORT -k CLIENT_KEY -ssl true & # linux 64bit nohup./client_linux_amd64 -s SERVER_IP -p SERVER_SSL_PORT -k CLIENT_KEY -ssl true & # windows 64 bit./client_windows_amd64.exe -s SERVER_IP -p SERVER_SSL_PORT -k CLIENT_KEY -ssl true
If there is no error, after the connection is successful, you can see on the webpage that the connection status of the client has become online, as follows:
As you can see, one of the above clients is connected and the other is offline.
If the above steps are normal, and finally the client shows the online status, you can go to the web page to view the camera, visit http://proxy-server-ip:8080 (for example: http://220.127.116.11:8080) to see if the display is normal.
If it cannot be displayed normally, please check the following problems in sequence:
The communication between the above camera and the public network server uses a host in the local area network as a springboard, and one needs to be turned on to ensure the normal connection of the camera, but this will cause some other problems, such as the host fan is too noisy, compared Power consumption, etc. After all, we only need a small transfer service, which will be wasteful. In order to solve this problem before, I was going to buy a Raspberry Pi as a traffic relay device in the LAN. After all, the power consumption of the Raspberry Pi is much smaller than that of a personal PC, and it is quieter.
Later, I found out that Meefik has developed related applications, which can directly deploy Linux systems on Android devices. So I thought, since Linux systems can be deployed, can it be possible to transfer traffic directly on the mobile phone where the camera is located? So I tossed it again and finally confirmed that the plan is feasible, but the process is more troublesome. Let me share the main process below.
Although the steps seem simple, there are indeed too many pits. As the Android system becomes more and more perfect, root is no longer needed in most cases, which makes many root tools unusable. After trying almost all root tools, and finally rely on the root permission obtained by flashing the machine. The device I use is an old Huawei mobile phone. First, I go to the official website to apply for unlocking the bootloader, then flash the third-party Recovery, and finally find a system with root permissions on the Internet to flash it in. It should be noted that if it is the main machine, it is still not necessary to flash the machine at present, because the flashing packages that can be found on the Internet are basically bundled with some junk applications, and most of them have not been updated for a long time because they are not profitable., so you need to be careful when brushing.
Of course, if the phone is basically useless, you can just toss it, but remember to uninstall all the junk apps as soon as possible after flashing the phone. I use the Es file browser and use its root toolbox to uninstall it in the system. Restart the device after uninstalling the junk apps.
If the root privilege is normally obtained, the follow-up is relatively simple. Go to Github·Busybox to download the apk file, and then install it on your phone. If bubblebox applies for root permission, click Allow.
After that, go to Github · linuxdeploy to download the file, and install it on the mobile phone as well. If you need to install the corresponding version of the system, you can search for related tutorials on the Internet, such as "linux deploy install CentOS". Because the tutorial is too long, I won't describe it here..
After the system installation is completed, the corresponding client is also long-transferred to the system using the scp command. For example, I have installed a kail system, the architecture is armv71, and the file client_linux_arm7 needs to be uploaded. After completion, use ssh to log in to the system, and follow the method in the previous step. Start the service. If you can see that the status is online on the webpage, it means that it can be used normally. The subsequent operation steps are the same as the previous two steps.
Using this method can save a transfer PC, turn on the camera on the same mobile phone, and connect to the server directly on the mobile phone, which saves power and avoids host noise.
We can view the camera by visiting.
If you have multiple cameras, you can use the above configuration to access different cameras through different domain names, without having to remember which annoying port addresses.
Using this solution to deploy the camera basically does not need to write code, just fill in some configuration files according to a fixed format, so you do not need to have a deep understanding of programming, the only troublesome may be the selection of the server, And some linux-related instructions, I believe that people who read this article have some understanding of linux. Even if they don't know much, it is very easy to learn. After all, there are only a few commonly used instructions that can be used here, even if not Yes, it's not a loss to spend an hour or two learning it.