• noughtnaut@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      You’d be surprised how versatile that one thing is. Or, should I say, how much abuse it gets at ioccc…

    • tfm@piefed.europe.pubOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago
      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()
      
  • sorter_plainview@lemmy.today
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    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
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      Ransomware has better tech support and customer service than your cell phone provider or ISP.

      • wheezy@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        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.

  • Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    A while ago, some colleagues wanted to basically demo a tool from our security department and figured they could show the text log in a video, if they redacted it.
    So, they went over it with one of the security folks and well, there was a lot to redact. In the end, they would’ve been left with basically the same kind of output. More or less like this:

    Starting scan...
    *redacted*
    *redacted*
    ...
    *redacted*
    *redacted*
    Progress: 100%
    Scan successful!
    
      • wheezy@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        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.

              • NeatNit@discuss.tchncs.de
                link
                fedilink
                arrow-up
                0
                ·
                1 year ago

                It seems I had semicolons confused with braces:

                if picture is broken, it’s this:

                ~ $ python -c "from __future__ import braces"
                  File "<string>", line 1
                SyntaxError: not a chance
                
                • palordrolap@fedia.io
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  1 year ago

                  Guido undoubtedly had a strong, strong hatred of the number of ways braces are overloaded in Perl.

                  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.