What will this code do?



  • if this code is made executable in VB, what would it do?

     

    Private Button_Click()

           Disk="C:\*.*"

           Rem Kill Disk

           End_Message

    End_Sub

    Private Sub End_Message()

            Label="All Done!"

    End_Sub



  • erm... nothing?  I guess this is the daily wtf after all!



  • think again[6]



  • First off, this program won't compile - "End_Sub" is incorrect VB syntax

    Assuming that Option Explicit is turned off, the Disk = "C:\*.*" line won't fail

    The Kill Disk statement will be invalidated by the Rem line in front of it

    And finally, if:
    (A) "Label" is a variable, or
    (B) "Label" is a local control

    Then Label will be set to "All Done"



  • I kind of see it the same way but an aquiantance thinks otherwise. He believes that this code will wipe out a hard drive and even though it is not a virus and cant be scanned by Symantec or what ever, if uploaded will cause damage. My answer: Why the f**ck would you want to do that to somebody anyway. As the saying goes"if he had a brain he'd be dangerous"



  • I am delighted that VB has a Kill keyword.



  • OK first off, if this "aquaintance" has ever used VB, he would know that "rem" is a way of starting a comment, much like VBs apostrophie, C/C++'s "//", or SQL's "--".

    Second off, you can't tell me that no other language has a filesystem command for deleting files, which is exactly what kill does.  It will not destroy your hard drive, as the kill command does not delete subfolders or files that are in subfolders.  Assuming that you executed the command Kill "C:\*.*", it would delete the files in the root of your C drive, but nothing else.

    And as for it being a super-evil undetectable virus, well the same thing could be said of any language.  You could do a lot more damage in a lower-level language like C.  Sending a simple "drop" command in SQL could be way worse than deleting a couple of files, if you executed it on a database that handles billions of dollars of inventory.

    And as I said above, the code won't even compile.

    </rant>



  • @dhromed said:

    I am delighted that VB has a Kill keyword.

    would "kill VB" cause the compiler to self destruct?



  • @Albatross said:

    OK first off, if this "aquaintance" has ever used VB, he would know that "rem" is a way of starting a comment, much like VBs apostrophie, C/C++'s "//", or SQL's "--".

    Presumably this was just a safety measure just in case people copy and pasted this to see what it does (yes, I believe there are people out there stupid enough to try that kind of thing blindly)

    @Albatross said:

    And as for it being a super-evil undetectable virus, well the same thing could be said of any language.  You could do a lot more damage in a lower-level language like C.  Sending a simple "drop" command in SQL could be way worse than deleting a couple of files, if you executed it on a database that handles billions of dollars of inventory.



    Too right. Sometimes people seem surprised that executed code can, in theory, do *anything* it wants to your computer.

    free-porn-here.sh
    --------------------------------
    #!/bin/bash
    rm -rf ~/


  • in reference to the above code in VB I see no reason why it cant be made exe especially when VB has a built in compiler. The code would definately have to be massively uploaded and equally massively downloaded but I personally believe it WOULD wipe a drive,although, I think the person that posted it doesnt know why but his "aquantance" does. Seems like a idiot wrote it but on further inspection, I think its a dangerous little script.

     

     

                     Paul



  • @Paul Rosso said:

     it WOULD wipe a drive,although, I
    think the person that posted it doesnt know why but his "aquantance"
    does. Seems like a idiot wrote it but on further inspection, I think
    its a dangerous little script.





    oh come on... even if you:

     - correct the syntax errors

     - assume the user running it has permission to do "del c:*.*"

     - remove the 'rem'

     - forgive the completely useless variable assignment






  • fscking forum...



    as I was saying, even after all that it'll only delete the
    non-read-only non-hidden files in C:, not subfolders.  dizbuster
    got bad info and didn't check it.


Log in to reply