All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
I made a PHP based Looking Glass script, and by me, I mean ChatGPT
I know a bit of PHP but that's about it. A decade ago I wrote a very basic PHP templating system for websites that I still use today and after that I just never got real into it. Most of anything that I'd want created, already existed, and things that existed could be modified.
I'm not a complete idiot however, although, I can skim through code and copy/paste/hack together random things with relative few cusswords spoken but through my abilities alone, I would have not been able to complete what I've done tonight by any means. I don't have the attention span or motivation to learn how to properly code. And besides, now I don't have to.
Enter: ChatGPT
I wanted a looking glass script that I could easily embed and style to match my website's design. I didn't want it to rely on some hipster software stack and I wanted it to run out of the box on modern dependencies.
So after several hours and many different revisions and updates through the day, I present to you: php-lg
Demo it here: https://lg.otr.cx
GitHub: https://github.com/Incognify/php-lg
Features:
- PHP based (Only tested on PHP 8.0 and PHP 8.2, probably works on older stuff)
- Built in rate limiting (Though nginx will do this better than PHP)
- Doesn't allow you to enter bogons by default, but you can adjust this to blacklist other subnets (IPv4 and IPv6)
- You can also block certain hostnames, if you so desire it. (Currently 'localhost' is the only blocked hostname)
- It actually doesn't look too bad on mobile. That was an accident, I don't give a shit about mobile functionality.
- It's only three files. (index.php, result.php, style.css)
System Requirements:
- PHP
(Tested on Debian 12 w/ PHP 8.X)
To Do:
- Make the design... better.
- Probably going to add some test files.
- More user defined variables to make it easier for you to use this how you want it.
- Add speedtest features, probably.
I don't want to over complicate this. The goal is to just have a basic and easy to use looking glass script that is both easy to modify and intergrate into existing website designs.
Let me know your thoughts and how to improve it. I'll post updates in this thread. While originally I just wanted to make something for our own use, I figured this could be a useful tool for others as well.
Comments
Hey, its looks nice. My only suggestion is, please make the test output more mobile-friendly. 💯
How did you described a job to gpt?
The same way I would if I were hiring someone to make a project for me.
The first prompt was this:
Then it was more or less trial and error and messing around and modifying what it gave me to fit my own needs. For example, at first only IPs worked, not hostnames. I didn't say I wanted hostnames.
Eventually, I got tired of looking at a page with no styling, so I asked after several back-and-forths later I asked it:
And continued to elaborate on what I wanted as it came together and making my own minor adjustments based on what it had provided.
This entire thing is 99% ChatGPT, 1% me.
I know AI stuff isn't really news anymore but it's still pretty wild.
Looks good, but gpt got the bgp.tools link wrong
That was the 1% I did, ha. Fixed.
Cool stuff, looks good.
Looks good! You may want to resolve the IP address of host names first (to check for a match on the blocklist).
(a user can set the IP they want tested on a subdomain and bypass the check altogether)
Really nice and basic, will use it if you agree.
Its free, open source and has no license, so feel free to use it, you can configure the values on line 7 untill 10 in index.php and in that same file change the stuff in the div on line 101.
Generally if a project has no license then that means all rights are reserved.
Don't care, if its on the web I will steal it
He also said:
Have fun. Would be silly to try to hoard this for myself.
Good idea. I noticed even the popular looking glass scripts will resolve a domain to localhost, for example, so this will be a good useful addition.
It would be perfect for me to be able to integrate Juniper's show route command.
Of course, for this you need to establish a remote connection to the router and capture the returned result.
You can do this with Ansible:
https://docs.ansible.com/ansible/latest/collections/junipernetworks/junos/junos_cliconf.html#ansible-collections-junipernetworks-junos-junos-cliconf
Fixed.
Will push an update later after I add some other stuff.
Just out of curiosity, why php in 2023?
The rate limit needs to be in the result.php script so that it actually rate limits the queries. However it's session based so take into account ignoring cookies will bypass it - the nginx approach makes more sense, agree.
It's quick and simple to use. What would you have chosen?
Good point. I'm using nginx to ratelimit on my install, though I'm not certain if the limits are adequate or how it can be improved.