Run nping through proxy server ubuntu - python

I am working on developing a Python program to ping websites through TCP. I used nping to ping websites through TCP continuously for a certain period of time, and it works great. After that, I added a proxy server option in the code to make nping work even through proxy server.
Next I installed a Squid proxy server and configured successfully. Now my problem is that nping works even with proxy server without any proxy authentication. I accessed the nping command in terminal, and it works, but other commands such as sudo apt-get update stop and show "proxy authentication required". Why is nping working even with proxy server enabled?
I read several articles and found that ping transfers ICMP packets, so it can't be blocked through proxy server. But nping send TCP packets, so why is it not getting blocked by the proxy server?

Related

SSL issue when trying to communicate with Python webserver on Raspberry PI by using a Progressive Web App

I'm trying to create a measurement device which can be controlled with a smart phone.
My situation
The places where I'm using the device don't have any internet connection available.
The measurement device uses a Raspberry PI, which creates a local WiFi network to communicate with the smart phone.
There is a Python webserver running on the RPI.
The smart phone has a PWA installed to send commands to the RPI's webserver.
The PWA is hosted on GitHub Pages (uses HTTPS by default).
After installation the PWA is supposed to work without an internet connection (just uses the RPI WiFi).
My goal is to successfully send requests to the Python webserver on the RPI by using the PWA on my smart phone.
My issue
When fetching the Python webserver within the PWA, I receive a Mixed Content error because the PWA is hosted on HTTPS (and also requires HTTPS) but the Python server is not.
When I tried using a self signed certificate created with OpenSSL, I receive a ERR_CERT_AUTHORITY_INVALID error.
I tried to use Let's Encrypt, but CertBot requires an actual domain. I only have an IP adress, which is the RPI's IP within its own WiFi network.
What should I do?
I fixed my issue by registering a free .tk domain pointing to 127.0.0.1 (localhost) and using Certbot from Let's Encrypt to create a SSL Certificate.
To validate the domain with Certbot I've used the TXT record validation.
In order to make use of the domain without an internet connection I've added a DNS record with the same .tk domain pointing to localhost inside the dnsmasq config file of the RPI.
My python webserver then uses the cert file to establish serving over HTTPS so the SPA on my mobile device won't throw an error when requesting data.

how can I post to api running on remote desktop?

I'm creating a python flask api on remote desktop and running it on localhost of remote desktop.
Is there anyway I can access this api from my local machine?
We are working in a team and I want to share this with my team members, but this is confidential and not to be deployed on open server.
We want to post and get the result with every member's local machine from api runnnig on remote desktop.
Both of our local machines and remote desktop are windows10.
Sorry for being abstract but I'm searching for any way out. Thanks.
Well, you should open your way to this API. You'll have to set up a VPN or IP address filter in the server so you can access the server from your network while still have it secured on the Internet. You can also setup a simpler proxy if you prefer it. I'll not cover the details on how to setup a VPN or proxy since it can get pretty extensive, but a Google search will help you out find the best alternative for you.
AFAIK, the Remote Desktop Protocol does not allow for any kind of VPN. However, if you can switch to TeamViewer, it does have an easy to setup VPN system that will allow you to get into the network with few configuration. Once a VPN is configured, it will work like if you were in the same network as the server, so from there you can access your API from your host machine by just going to the IP address of the server.
Do notice the security policies of whoever owns the server, since you can get into trouble if you don't have permission to enable some access from the outside. Security goes always in front of comfort.
Short term solution:
Firstly download ngrok for your operating system.
For debugging and testing purposes you can expose a secure tunnel connection to your API by running this command in your command prompt / terminal.
ngrok http <PORT_NUMBER>-host-header="localhost:<PORT_NUMBER>"
Where PORT_NUMBER is the port number in which your flask application is running.
Example if your flask application is running at port 5000 then simply execute this command:
ngrok http 5000 -host-header="localhost:5000"
Running this will give you two hostnames one with HTTP and other a secure HTTPS connected by a tunnel like this for a duration of 8 hours after which the command needs to again re-run.
Which you can call remotely
Long term solution:
Deploy flask application using FastCGI
or
To a cloud infrastructure provider like Microsoft Azure which gives readymade templates for flask applications.

python request remote web server via CLI through a ssh tunnel?

I installed a web server on a remote machine that can be only access through a ssh tunnel. Therefore, I have run with putty a ssh tunnel by specifying a port forwarding (in my case 8159). I have also configured the socks proxy on my browser to access to my remote webserver. Futhermore, with a curl command I can get the webpages if I add the following option --sock5-hostname localhost:8159.
Now, I would like to use python to request those webpages by passing through the ssh tunnel that I have configured with putty. I tried pysocks and proxy environment variables in my python code but it did not work. I would like to know if you have an idea to solve this problem.
Thank you in advance.

port is listening in server but unable to telnet ( Django with Apache )

I have developed a Django application which I wish to deploy on apache2.4 server. I have configured mod_wsgi and stuff on a system, which is going to be my server and localhost:8081 (apache's port) is working properly on the server system. I am in a corporate environment. When I wish to access the application from another system, I am unable to access the page.(The server and client are in the same network, both using LAN)
Observations:
8081 port is listening on my server system
(Proto: TCP, Local Address: 0.0.0.0:8081, Foreign Address: Computername:0, State: LISTENING)
I am unable to telnet to server ip on port 8081
(Connecting To 10.176.241.35...Could not open connection to the host, on port 8081: Connect failed)
Able to ping server IP (EDIT)
I have JDeveloper installed in my server system and I am able to access
the homepage of WebLogic server from another system though.
Site can't be reached, took too long to respond error while trying to
access the page from client system
What all I have done so far:
Followed the exact steps mentioned in here for configuring apache with django
Turned off firewall in both client and server systems
Add inbound and outbound exception rules in Advcanced firewall
settings in both client and server systems
I am unable to know the root cause of this problem and I have been working on this for a week and a half. I do not have much knowledge in networking and I am badly in need of some help. Sorry if the question is too naive.

Openshift bind TCP port

I'm trying to deploy a python TCP listener on Openshift but I'm failing to understand how to manage external ports.
Googling and searching on Openshift's own KB, this article is mentioned lots of times but is no longer available. My TCP server app listens on port 8080 (as per $OPENSHIFT_PYTHON_PORT) and I'm trying to connect to it from the Internet on port 8000. Nevertheless, doing this means that a client app can establish a connection even if the server app is not started.
Does anyone have specific information on how to do this?
You can not make raw tcp connections to your OpenShift gears, you can only make http (80/443) and ws (8000/8443) connections. Both types of connections go through a proxy on the node, http goes through an apache proxy, and ws goes through a node proxy. If you want to make raw tcp connections you would have to use port forwarding from your location machine, and make sure that you are publishing the port information through a custom cartridge.
An Internet Archive grab of the removed KB article you mentioned says you could bind to internal ports 15000 to 35530. But this has now changed: my test OpenShift box didn't let me bind to any localhost port. Its $OPENSHIFT_PYTHON_PORT is accessible from the outside via normal Web ports (80 and 443; SSL decryption is done for you on 443). If you need other ports you probably need something other than Openshift.

Categories