mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2026-02-03 14:13:26 +00:00
VirusTotal Scanning #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Aetherinox on GitHub.
I've read over the docs, and I don't know why, but I can do every other action with this app. But for some reason, testing VirualTotal never works.
And then transfer.sh logs returns a curl 500 error.
Just to eliminate something dumb, I even used the example straight out of the docs, and created a file named
nhgbhhj; with text inside to ensure it wasn't trying to push an empty file.If I add a
/to the end of the URL, or change the capitalization, no error, but nothing posts or outputsAny help would be awesome with this.
I found the log file, which outputs the following:
But no matter what I do, I get the
<error. And after looking online, it appears to be a GoLang JSON error.After looking through the code, it appears to be coming from the Go package https://github.com/dutchcoders/go-virustotal via the line
The
erris returning@Aetherinox commented on GitHub:
I've been tearing through the code. It's the damn hardcoded URL at
24cc8e6fa3/virustotal.go (L310)It needs to be changed to
https:Then if I run the virustotal
vt.gomodule by itself, I finally get a responseWithout the
http -> httpschange, you just getI then took the revised code in the go module, loaded it as a local package into transfer.sh, and I get a response
And VirusTotal reports back an increase in API usage
And transfer.sh logs outputs a 200 success
The question becomes, does anyone who is active have access to that repo to make the URL changes to push a PR. Obviously the snippet you pasted needs to be refactored to handle errors a bit better, but at least this allows VT to work in transfer.sh
There's two places where the URL needs adjusted.
24cc8e6fa3/virustotal.go (L259)24cc8e6fa3/virustotal.go (L310)@paolafrancesca commented on GitHub:
@Aetherinox , thank you very much for your investigation and I apologize for the lack of proper information in the documentation. I'd kindly ask you, if you'd the time to open a PR on https://github.com/dutchcoders/go-virustotal with your fixes.
I'm not sure I'm the maintainer of the repository, so if you'd be open to mantain your fork i would be more than glad to change the depedency on the main transfersh repo to your maintained version of go-virustotal
@paolafrancesca commented on GitHub:
hello @Aetherinox , i haven't used the virustotal endpoint in ages
i've checked what the dutchcoders go-virustotal package does: https://github.com/dutchcoders/go-virustotal/blob/master/virustotal.go#L305
at https://github.com/dutchcoders/go-virustotal/blob/master/virustotal.go#L349 an err might occur that is not returned, then the write can be actually closed with no error (https://github.com/dutchcoders/go-virustotal/blob/master/virustotal.go#L351) sending an empty mime part of the file part to the api
i checked the virustotal api: https://docs.virustotal.com/v2.0/reference/file-scan: do you see the curl code snippet? could you try to run it sending an empty file? i don't have an api key available at the moment.
please add
-vvvto the curl request, share the full output from the command (eventually hiding sensitive data)@Aetherinox commented on GitHub:
Last part, and I'm done messing with this for now.
The README.md for transfer.sh and also missing the env definition for the VirusTotal API key. I had to go digging through the code to see what it was.
Without providing a VirusTotal API key to transfer.sh, you also get the same error
Readme just needs this addition:
So until that error handling in the go module is fixed, that
<error is just going to be a catch-all anytime it cannot talk to VirusTotal.For the time being I'm using my own modified. And I'm going to look into refactoring that error so that it properly returns what the issue is
go.mod
go.sum
/server/virustotal.go
Here's the repo:
@Aetherinox commented on GitHub:
Alright, did a bunch of tests just to make sure that file could even be scanned at all by VT using normal curl. First I'll provide the "invalid file" tests, and then the successful.
Provided File Path, But Is Not Valid File
This attempt tries to pass a file which just doesn't exist at all
/server/nhgbhhj222File Exists, But Empty / 0 bytes
This attempt tries to pass a file which exists, but is empty / at zero bytes
/server/nhgbhhjEmptySuccessful Valid File
This attempt passes a valid file with contents inside the file.
/server/nhgbhhAnother transfer.sh attempt
Since the file is seen by VirusTotal as fine, I tried to pass again to transfer.sh
Also tried
--upload-file /server/nhgbhhjand./nhgbhhjand I also kept track of the API calls via VT before and after I used transfer.sh app; stayed at
0 requests, however, when using the curl method:@Aetherinox commented on GitHub:
Yeah I can do that. I updated a few things with the dependency because it appears there's no longer any work being done to it from the original developers.
But I'll prepare a PR.
There's a few other things in the go package that I want to address, but I wanted to see first if it would be useful before I start spending the time on it. But they're not breaking issues. Just needs better clarity for the end-user as the errors do not give details in the event of failures, which can be a pain for debugging.
@Aetherinox commented on GitHub:
So you can pick which route you want to go. I submitted two PRs:
If you have contrib status on the VT go repo, you can just approve those changes. If not, I submitted a PR for this repo which switches the package over to mine, as well as updates the documentation to specify the Virtual Total API param / env var.