Bugswriter / tuxi

Tuxi is a cli assistant. Get answers of your questions instantly.
GNU General Public License v3.0
1.33k stars 73 forks source link

Added my IP search results #156

Closed BatteredBunny closed 3 years ago

Genghius commented 3 years ago

nice, does it pass al the tests?

BatteredBunny commented 3 years ago

Yeah it does

BeyondMagic commented 3 years ago

This should not be the first to scrap.**

sudocanttype commented 3 years ago

Ok, can you run ./tuxiqualitytest.sh -r and send the testoutputs file?

BeyondMagic commented 3 years ago

How can we test it, actually? Should we add a query in the tests files, even though showing the public IP can be a problem for some?

sudocanttype commented 3 years ago

Huh. Good point. I could program it to show on the users screen and not write to testoutputs.txt, or, even better, I could make it all on the user side by comparing the output of the function to the output of https://api.ipify.org/, and if it fails, it would just output a fail message.

BeyondMagic commented 3 years ago

Google Search outputs two different types of public IP, I am getting IPV6 in Google and IPV4 in IPIFY. I think just showing if it got any numbers is enough.

sudocanttype commented 3 years ago

Oh, I forgot I disabled IPV6 on my PC. That could work too. Or we could make sure what google pulled complies with the format of a IP address with some regex.

BeyondMagic commented 3 years ago

Well, yes, that will take more work but it's good, too*.

BatteredBunny commented 3 years ago

Regex is the best option

BeyondMagic commented 3 years ago

Change the priority of this, scrapping of IP should be at least the last one...

sudocanttype commented 3 years ago

I can make a PR for testing the new IP feature

BatteredBunny commented 3 years ago

Not sure how to add IP test but here is the regex for matching IPV4/IPV6 that comes out of tuxi input ((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])))

sudocanttype commented 3 years ago

..... wtf. Just what. I got it working for IPV4, but I'm terrible at regex so f*ck this. IPV6 is too complicated "Be sure to write it out in multiline mode and with a pile of comments so whoever is inevitably tasked with figuring out what this means doesn't come after you with a blunt object."

sudocanttype commented 3 years ago

JK, I'm dumb. I made it work 20 dummy ipv4 and ipv6 addresses, should be good to go. @ayes-web I made a PR to ur main branch for the test file, merge it and try it out

#

Not sure how to add IP test but here is the regex for matching IPV4/IPV6 that comes out of tuxi input ((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])))

Also this wasnt necessary, i just made sure it followed the general syntax of a ipv4/6 addr, because what else could it possibly return

sudocanttype commented 3 years ago

@ayes-web uhhhhhhhhhhhhhhhh can we not log the ip address to testoutputs? We like to send that file in these comments as proof that everything is working, and most of us would not like to leak our ip. I purposefully made it so that it would print out, but not log

BatteredBunny commented 3 years ago

@ayes-web uhhhhhhhhhhhhhhhh can we not log the ip address to testoutputs? We like to send that file in these comments as proof that everything is working, and most of us would not like to leak our ip. I purposefully made it so that it would print out, but not log

Ah sorry, thought it was just a mistake