News for hackers. Stuff that matters.
Re:We spent $20 to achieve RCE and accidentally became the a... by lovasoa on Wednesday September 11, 2024 @02:27PM (#41513987)
> $ sqlite3 whois-log-copy.db "select source from queries"|sort|uniq|wc -l

Oh cool they saved the logs in a database ! Wait... |sort|uniq|wc -l ?? But why ?

Re:We spent $20 to achieve RCE and accidentally became the a... by mjevans on Wednesday September 11, 2024 @03:34PM (#41514612)
SELECT COUNT( DISTINCT source ) FROM queries ORDER BY source ASC

-- COUNT ( DISTINCT ... ) ~= uniq | wc -l ;; sort without -u is this busybox? ORDER BY col ASC

-- wait this doesn't need sort and uniq if it's just being counted...

SELECT COUNT( DISTINCT source ) FROM queries

Re:We spent $20 to achieve RCE and accidentally became the a... by Woovie on Wednesday September 11, 2024 @04:09PM (#41514937)
bash nerds vs sql nerds I guess, these people are bash nerds
Re:We spent $20 to achieve RCE and accidentally became the a... by SSLy on Wednesday September 11, 2024 @02:41PM (#41514116)
beats up re-re-remembering how to do it in sql
Re:We spent $20 to achieve RCE and accidentally became the a... by radicality on Wednesday September 11, 2024 @02:59PM (#41514279)
And probably because for quick things like that you’re already working in a “pipeline”, where you first want to see some of the results so you output with SQLite, and then add more to the pipeline. Similarly, I often do ‘cat file | grep abc’ instead of just grep, might be probably out of habit.
Re:We spent $20 to achieve RCE and accidentally became the a... by mr_mitm on Thursday September 12, 2024 @03:30AM (#41518390)
I found that this is actually a good use case for LLMs. You can probably paste that one liner up there and ask it to create the corresponding SQL query.
Re:We spent $20 to achieve RCE and accidentally became the a... by SSLy on Thursday September 12, 2024 @04:03AM (#41518584)
yeah, they're good for cursed tools like that, ffmpeg, excel macros, etc etc
Re:We spent $20 to achieve RCE and accidentally became the a... by lilyball on Wednesday September 11, 2024 @05:38PM (#41515571)
yeah, they could have done `sqlite …|sort -u|wc -l` instead and saved themselves a process invocation!
Re:We spent $20 to achieve RCE and accidentally became the a... by silisili on Wednesday September 11, 2024 @07:42PM (#41516280)
Hey now if you're just gonna count lines no need to sort it at all.
Re:We spent $20 to achieve RCE and accidentally became the a... by lilyball on Wednesday September 11, 2024 @08:18PM (#41516461)
you need to sort it in order to uniq it, because uniq only removes duplicate consecutive lines.
Re:We spent $20 to achieve RCE and accidentally became the a... by silisili on Thursday September 12, 2024 @12:44AM (#41517677)
You know, it's been so long since I've used it, I completely forgot that fact. Alright, you win the battle of best correct bad sql to bash pipeline :).