autologon to a django web app - python

I Would like to write a little django web-app to be run in my local WLAN, to allow my customers to browse thru the offers that I made available.
The WLAN is not password protected and isolated from web.
Ideally, I would like that when a user connect to my wlan with a smartphone or tablet, he or she is been jumped directly to the offer webserver, without entering any address or url.
Is there any combination of port forwarding/triggering on the wlan router and the webserver that can accomplish this task ?

I think that for this purposes you need openwrt or similar firmware for your router, or as a second solution you can make one of your computers as internet-gateway, so router will get internet from this gateway, and on a gateway there should be an app/config/etc. , which redirect user to your app, when user firstly open any page.

Related

My Flask python web application is not accessible from a domain name

I have programmed in python a web application using flask. I decided to deploy it from my home with a raspberry pi which runs the code continuously. I would like it to be accessible from a web browser and for that I have thought to configure my router to redirect the requests to my server. I also took care to configure my firewall accordingly. It turns out that the application works well and is perfectly accessible by typing its public IP in my URL bar. The problem is that I can't access it using a domain name. I have rented a new one and I have configured the DNS records so that it points to my server. I tested the DNS servers and it seems that the pointing is effective. However, when I enter the domain name I don't get my web application but the page of hostinger, the hosting company where I rented the domain name. I have contacted the technical department and they assure me that the problem is not in the DNS but in the hosting, so in my python code. This leaves me perplexed because my web application is accessible from its public IP. So the code should be good.
Please do not hesitate to ask me for additional details, either on the level of my python program or on the level of my server.
Thanks in advance for your help

How to identify the user or machine making an HTTP request to an Apache web server on RHEL 7 using server side Python or client side script?

I have a RHEL 7 Linux server using Apache 2.4 as the httpd daemon. One of the pages served by Apache is a simple https form that is generated using Python 3.11. Currently, the form is submitting and being processed properly, but we have no way to track where the form was submitted from.
Ideally, there would be a field for users to enter their user name, but we have no way of validating if the user name is valid or not.
I would like to add a hidden field to the form that would contain one of the following:
User name used to log into the clients computer from where the form was submitted.
Computer name of the clients computer from where the form was submitted.
IP address of the clients computer from where the from was submitted.
I do not care if this data is discovered by Python while the page is being generated, or by a client side script embedded in the generated web page.
The majority of users will be using Windows 10 and Chrome or Edge as their browser, but there will be Apple and Linux users and other browsers as well.
Is this possible? If so, how?
Would you like every website to have access to your local user- or computer-name, or other local information available to your browser? While there is an aweful lot of information available to webapps, this privacy invasion is not.
The server will have a record about the sending IP address though, naturally - even without it being part of a form.
As to the "how": The Python script that processes the submitted form does have access to the request parameters, and with it typically the remote IP address. What you do with it (e.g. save it) is yours. You'll obviously also find the remote IP address in the Apache logs - but there it's disassociated with the actual form submission.

how to ip proxy in django route

There are websites like, "XYZ.com" and "ABC.com" and those websites can only be accessible with such a range of ip addresses.
We have public IP and using that third party website are accessible. (with only office premises we can access those website)
I have to develop a website (djangoproxy.com) in django so that I can access those third party websites from outside the public ip range.
so i plan to access those website like,
XYZ.djangoproxy.com,
ABC.djangoproxy.com
There is one condition, that access is based on only authenticated users. So I have to write code on djangoproxy.com for an authentic user. and after successfully login open a third party website in the same browser tab.
Had checked some python packages for vpn,
https://gist.github.com/Lazza/bbc15561b65c16db8ca8
Reference:
Python requests, change IP address
Can you guide me if this functionality can be developed using python code or any web-server configuration.
I am using NGINX as a web-server to host djangoproxy.com.
You can use django-revproxy for your purpose. Your Django server will sit between the client and the external website. You can add the authentication logic of Django and allow proxy for only authenticated clients.

How to implement native browser based OpenID Connect authentication in Python?

I am writing a console application in Python, which has to communicate with a network service using OpenID Connect based authentication.
The users of the tool usually already are logged in using their favorite browser.
How can I open/ call the native browser from Python in a way, that I can return the access token?
Opening a http server, which gets a request via redirect URI does not work due to the configured personal firewall for most of the users by IT.
The webbrowser.open seems to provide no way to return data.
https://learn.microsoft.com/en-us/windows/uwp/security/web-authentication-broker seems to be no working solution for my kind of application, due to not being a Windows application registered in the Microsoft Store, but an in-house tool.
You may assume that all users use recent Windows clients.
A console app uses desktop OAuth according to RFC8252 and these are the login return options from a browser:
Loopback
Private URI scheme
The latter may work for your use case, where the redirect URI has this form. The scheme is registered for the current user and this does not require admin privileges:
x-mycompany-myapp:/callback
You can run my Desktop Code Sample to see how this looks. You can test whether this works for users via a web page like this.
I'm no expert on Python but there are Python online tutorials available on this topic.

python application is not working where i use vpn or #work

I wrote a python application and it works fine on my private network.
The application uses requests package and constantly fetching data from Yahoo.finance.
However when my computer is connected to my work network (either through VPN or where i am actually #work),
The application is not working.
Is there a way to make it work?
Asaf
Look into the firewall settings, or company list over blocked URLs.
It could be that your work has blocked the Yahoo.finance domain or specific applications from having outbound traffic as well.
You might also have success with privilege escalation to admin user which could grant you wider access.
Check if you can ping Yahoo.finance from a terminal or simply open it manually from a few different browsers (Edge, Chrome, Firefox etc.).
Then try to see if you from inside your Python application can fetch any URL with the request module, just to troubleshoot.

Categories