jagrosh / Selfbot

A simple Discord selfbot that is fast and easy to set up and use
Apache License 2.0
99 stars 55 forks source link

Add bash command #41

Closed spotlightishere closed 7 years ago

spotlightishere commented 7 years ago

This PR would fix #38 if merged. It outputs the command in a similar format to eval (saying both input and output) but has a major drawback.

It would appear that Runtime.getRuntime().exec has issues with relative commands. For example, you're unable to bash ls -l ~ but you're able to bash ls /home/spotlight, which I find odd. I have no idea what the issue is and it would appear that Google doesn't either.

Special thanks to @ArtutoGamer for helping me out with this as well. This PR is 10000x better than #39 😅

jagrosh commented 7 years ago

Since this prints error traces to console, maybe it should print results that are too long to console as well. Alternatively, it could upload a txt file with the results

spotlightishere commented 7 years ago

After messing around with the command for a bit, I found out that Runtime.getRuntime().exec halts the program if anything is sent to stderr for the error's InputStream to be read. Instead of finding some way to incorporate the two, I switched to using ProcessBuilder instead.

See also, https://stackoverflow.com/a/23878137/3874884

(Also, I added in outputting to console. Uploading a file wouldn't be fun as we'd have to check permissions and blek.)

ajloveslily14 commented 7 years ago

What about instead of uploading a file it just posts to pastebin or something like that? Would there have to be a perm check for the file upload? Wouldn't it just fail silently?

spotlightishere commented 7 years ago

Doing pastebin could work indeed, though we'd have to bring up an API and even then I'd rather use Ghostbin (or a user might want to use Hastebin, etc). If jag wants it I could add it, otherwise output to the console is good for now.

Artuto commented 7 years ago

Or writting it to a .txt file and uploading it to Discord?

El ago 13, 2017 6:59 PM, "Spotlight" notifications@github.com escribió:

Doing pastebin could work indeed, though we'd have to bring up an API and even then I'd rather use Ghostbin for that point. If jag wants it I could add it, otherwise output to the console is good for now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jagrosh/Selfbot/pull/41#issuecomment-322075717, or mute the thread https://github.com/notifications/unsubscribe-auth/AI2CdddNnBiPFR7mqpc5LF1GO8JJ5EpNks5sX43OgaJpZM4OgpMK .

ajloveslily14 commented 7 years ago

Yeah the text file sounds fine, he just said it'd be a pain because of upload perms.

On Sun, Aug 13, 2017 at 11:14 PM, Artuto notifications@github.com wrote:

Or writting it to a .txt file and uploading it to Discord?

El ago 13, 2017 6:59 PM, "Spotlight" notifications@github.com escribió:

Doing pastebin could work indeed, though we'd have to bring up an API and even then I'd rather use Ghostbin for that point. If jag wants it I could add it, otherwise output to the console is good for now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jagrosh/Selfbot/pull/41#issuecomment-322075717, or mute the thread https://github.com/notifications/unsubscribe-auth/ AI2CdddNnBiPFR7mqpc5LF1GO8JJ5EpNks5sX43OgaJpZM4OgpMK

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jagrosh/Selfbot/pull/41#issuecomment-322096264, or mute the thread https://github.com/notifications/unsubscribe-auth/AFTY8Pnr0Rn6PkEwbtwQGTr1C3OFtsTsks5sX8m2gaJpZM4OgpMK .

-- Yours Truly, Alexander Wallen

jagrosh commented 7 years ago

Gonna merge this now, might be a good idea to add the txt file upload at some point in the future though