Needs a 99% print too just before the 5 second sleep. Followed by a 99.9% and another 2 second sleep. Never print 100 and just run a traceroute in a loop.
Followed by a "we're in" from the hacker as we're made to believe he's reading the console spam like he's Neo from the matrix as he types faster and faster into an unresponsive terminal window.
Guido undoubtedly had a strong, strong hatred of the number of ways braces are overloaded in Perl.
::: spoiler Do you really want an example?
sub doHref { { do { ${someglobal{Href}} = {} }; last }; }
Every single pairing there serves a different syntactic purpose. Some are related purposes, and I've crowbarred a few in unnecessarily for the sake of an example, but different nonetheless.
The outer pair declares the sub, and the next pair is a free block that works as a once-through unlabelled loop, which is exited with the last. (Most other languages use break for this purpose.)
The next pair are for the do which doesn't act as a loop like the free block does. The next innermost pairing wrap a variable and the inner, innermost pairing indicate that the variable is a member of a hash (associative array) and we're accessing the record named Href.
The lone {} indicates a hash reference, so we're assigning a reference to an empty, anonymous hash to that hash record.
This example is ridiculous of course. There's no need for most of those braces and syntax to do what it actually does. Also assigning to global variables is generally frowned upon.
sub doHref { $someglobal{Href} = {} }
... is equivalent and cuts out most of the guff. Still three different uses though.
:::
You know hackers in the movies are very polite and care for their user. When they are hacking or wiping the disk they show proper progress. That is much better user experience than many corporate products. Be like hackers in the movie.
Their profits come from actual "customers". They can't just layoff half of their work force and use stock buybacks to make the line go up. Shit has to actually work.
I have seen like 2 movies where the hacker just ran a script and danced around the room until the progress bar got to the top, then he hit a couple inputs and ran another script and went back to dancing. It was so surreal to see something so much closer to real than the feverish hammering in a keyboard.
There's also The Core where the hacker says "yea, I can do it", demands unlimited hot pockets and all of Xena Warrior Princess on VHS, then locks himself up in his room.,
import sys
import time
from typing import Iterable, Callable, Any
class ProgressSimulator:
"""
A class to simulate and display the progression of a hacking process,
with unnecessary abstraction and complexity for dramatic effect.
"""
def __init__(self, description: str = "FBI"):
self.description = description
self.progress_steps = [0, 20, 40, 60, 80, 100]
self.messages = [
f"Starting Hack...",
*[f"Hacking {self.description} {step}%" for step in self.progress_steps],
f"{self.description} Hacked Successfully"
]
def generate_progress(self) -> Iterable[str]:
"""Generates the progress messages."""
for message in self.messages:
yield message
def display_progress(self, delay: float = 0.5) -> None:
"""Displays the progress messages with a delay."""
for message in self.generate_progress():
print(message)
time.sleep(delay)
def execute_hack(self, callback: Callable[[str], Any] = print) -> None:
"""Executes the hacking process with a callback for each step."""
for message in self.generate_progress():
callback(message)
def create_hacking_sequence(description: str = "FBI") -> ProgressSimulator:
"""Factory function to create a hacking sequence."""
return ProgressSimulator(description)
def main() -> None:
"""Main function to orchestrate the hacking simulation."""
hacking_sequence = create_hacking_sequence()
hacking_sequence.display_progress()
if __name__ == "__main__":
main()
58 Comments
gigachad@piefed.social · 164 pts · 336d
I guess you could add some
sleep(1)inbetween9point6@lemmy.world · 93 pts · 336d
Needs to be a
sleep(3)andsleep(5)between the last ones just to add suspensetoynbee@lemmy.world · 41 pts · 336d
idunnololz@lemmy.world · 6 pts · 335d
No it has to be controlled suspense.
wheezy@lemmy.ml · 9 pts · 336d
Needs a 99% print too just before the 5 second sleep. Followed by a 99.9% and another 2 second sleep. Never print 100 and just run a traceroute in a loop.
Followed by a "we're in" from the hacker as we're made to believe he's reading the console spam like he's Neo from the matrix as he types faster and faster into an unresponsive terminal window.
xav@programming.dev · 79 pts · 336d
This is Python. It's already show enough.
gigachad@piefed.social · 27 pts · 336d
StarvingMartist@sh.itjust.works · 22 pts · 336d
Ooof starting the day with violence I see
xav@programming.dev · 11 pts · 336d
"One troll a day keeps the intelligent people away"
ripcord@lemmy.world · 9 pts · 336d
That's not python
gigachad@piefed.social · 46 pts · 336d
It's valid Python code though, the semicolons will run but are unnecessary
NeatNit@discuss.tchncs.de · 36 pts · 336d
I am so perplexed and horrified. I'm going to need several weeks to get over this. What is this?!
Mad_Punda@feddit.org · 21 pts · 336d
A way to have several statements on the same line?
NeatNit@discuss.tchncs.de · 12 pts · 336d
It seems I had semicolons confused with braces:
if picture is broken, it's this:
palordrolap@fedia.io · 7 pts · 336d
Guido undoubtedly had a strong, strong hatred of the number of ways braces are overloaded in Perl.
::: spoiler Do you really want an example?
sub doHref { { do { ${someglobal{Href}} = {} }; last }; }Every single pairing there serves a different syntactic purpose. Some are related purposes, and I've crowbarred a few in unnecessarily for the sake of an example, but different nonetheless.
The outer pair declares the
sub, and the next pair is a free block that works as a once-through unlabelled loop, which is exited with thelast. (Most other languages usebreakfor this purpose.)The next pair are for the
dowhich doesn't act as a loop like the free block does. The next innermost pairing wrap a variable and the inner, innermost pairing indicate that the variable is a member of a hash (associative array) and we're accessing the record namedHref.The lone
{}indicates a hash reference, so we're assigning a reference to an empty, anonymous hash to that hash record.This example is ridiculous of course. There's no need for most of those braces and syntax to do what it actually does. Also assigning to global variables is generally frowned upon.
sub doHref { $someglobal{Href} = {} }... is equivalent and cuts out most of the guff. Still three different uses though. :::
ICastFist@programming.dev · 4 pts · 336d
Python
NeatNit@discuss.tchncs.de · 2 pts · 336d
Blasphemy!
ripcord@lemmy.world · 2 pts · 336d
Yeah but it wasnt intended to be python
gigachad@piefed.social · 6 pts · 336d
Maybe we should call the meme police then
ripcord@lemmy.world · 1 pts · 336d
On xav?
GreenKnight23@lemmy.world · 57 pts · 336d
what about the sleeps between each print?
where's the comments?
why isn't it DRY?
3/10 code, PR rejected.
urandom@lemmy.world · 16 pts · 335d
// this prints 80%
BrokenGlepnir@lemmy.world · 4 pts · 335d
This is python
boonhet@sopuli.xyz · 3 pts · 335d
Python with semicolons? I mean I guess it’ll run but why
BrokenGlepnir@lemmy.world · 2 pts · 335d
For the POWER of doing something UNNECESSARY because you CAN
sorter_plainview@lemmy.today · 46 pts · 336d
You know hackers in the movies are very polite and care for their user. When they are hacking or wiping the disk they show proper progress. That is much better user experience than many corporate products. Be like hackers in the movie.
jaybone@lemmy.zip · 21 pts · 336d
Ransomware has better tech support and customer service than your cell phone provider or ISP.
wheezy@lemmy.ml · 9 pts · 336d
Their profits come from actual "customers". They can't just layoff half of their work force and use stock buybacks to make the line go up. Shit has to actually work.
rbn@sopuli.xyz · 36 pts · 336d
For those who want a more convincing but still low-effort variant of this, use... https://hackertyper.net/
Press F11 in your browser to run it in fullscreen.
lemmyknow@lemmy.today · 8 pts · 336d
The Hollywood command is effortless and runs on terminal
TankovayaDiviziya@lemmy.world · 33 pts · 336d
Did he type the furiously on to the keyboard? No? Then it's not hacking.
Adalast@lemmy.world · 28 pts · 336d
I have seen like 2 movies where the hacker just ran a script and danced around the room until the progress bar got to the top, then he hit a couple inputs and ran another script and went back to dancing. It was so surreal to see something so much closer to real than the feverish hammering in a keyboard.
WhyJiffie@sh.itjust.works · 5 pts · 335d
ah yeah, I'm always dancing when hacking gov systems
A_norny_mousse@feddit.org · 2 pts · 335d
Which movies?
Hoimo@ani.social · 1 pts · 335d
There's also The Core where the hacker says "yea, I can do it", demands unlimited hot pockets and all of Xena Warrior Princess on VHS, then locks himself up in his room.,
Natanael@infosec.pub · 12 pts · 336d
https://hackertyper.com/
A_norny_mousse@feddit.org · 2 pts · 335d
Classic! Sometimes I call it up just to enjoy that feeling.
cupcakezealot@piefed.blahaj.zone · 19 pts · 336d
have you seen who runs the fbi? this'll probably work irl
Damage@feddit.it · 17 pts · 336d
It takes skill to hack such an organization using only printf
noughtnaut@lemmy.world · 2 pts · 335d
You'd be surprised how versatile that one thing is. Or, should I say, how much abuse it gets at ioccc.....
Evilschnuff@feddit.org · 9 pts · 336d
The hacking in Mr Robot looked more authentic, I really liked it. But they usually just executed some random scripts without printouts lol.
kambusha@sh.itjust.works · 9 pts · 336d
I've been hacking the world this whole time!
lemmydividebyzero@reddthat.com · 8 pts · 335d
Yeah, few people know that the FBI tells you the progress when hacking them.
misteloct@lemmy.dbzer0.com · 8 pts · 336d
goatinspace@feddit.org · 2 pts · 335d
Prints a long summary with hallucinations
paulbg@programming.dev · 8 pts · 336d
behind the scenes: youtube video of a python loop
stupidcasey@lemmy.world · 8 pts · 335d
But look how much effort he put into ricing his terminal this guy's good.
j4k3@lemmy.world · 7 pts · 336d
what HP printers really do
jaybone@lemmy.zip · 3 pts · 336d
In Soviet Russia, print() statement runs on printer.
Lucidlethargy@sh.itjust.works · 5 pts · 335d
Guys, you can't just come in here and post exactly how hackimg works.
That's illegal!!1!
dumnezero@piefed.social · 4 pts · 336d
not even a loop.
tfm@piefed.europe.pub · 19 pts · 336d
orhtej2@eviltoast.org · 12 pts · 336d
Enterprise grade 👌
yogsototh@programming.dev · 5 pts · 336d
yep https://github.com/leo-aa88/HelloWorldEnterpriseEdition
tetris11@lemmy.ml · 7 pts · 336d
"How many times are you going to run this, and how many in parallel?"
"Just once, and exactly one."
"Better make a full OO class for it."
dumnezero@piefed.social · 4 pts · 336d
jaybone@lemmy.zip · 0 pts · 336d
I can do this in C in three lines.
OfCourseNot@fedia.io · 6 pts · 336d
Newlines mean nothing in c. You can literally write any program in three lines of c, if you don't give a crap about readability.
jaybone@lemmy.zip · 1 pts · 336d
Oup, don’t forget about those preprocessor directives.
Ephera@lemmy.ml · 2 pts · 335d
MonkderVierte@lemmy.zip · 1 pts · 336d