Esempio n. 1
0
        public async Task CreateLargeComment()
        {
            byte[] content      = new byte[1024 * 4];
            string contentInHex = HashHelper.ByteArrayToHex(content); //2x size now

            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await VirusTotal.CreateCommentAsync(TestData.TestHash, contentInHex));
        }
Esempio n. 2
0
        public async Task CreateCommentOnUnknownResource()
        {
            CreateCommentResult comment = await VirusTotal.CreateCommentAsync(TestData.GetRandomSHA1s(1).First(), "VirusTotal.NET test - " + DateTime.UtcNow.ToString("O"));

            Assert.Equal(CommentResponseCode.Error, comment.ResponseCode);
            Assert.Equal("Could not find resource", comment.VerboseMsg);
        }
Esempio n. 3
0
        public async Task CreateValidComment()
        {
            CreateCommentResult comment = await VirusTotal.CreateCommentAsync(TestData.TestHash, "VirusTotal.NET test - " + DateTime.UtcNow.ToString("O"));

            Assert.Equal(CommentResponseCode.Success, comment.ResponseCode);
            Assert.Equal("Your comment was successfully posted", comment.VerboseMsg);
        }
Esempio n. 4
0
        public async Task CreateDuplicateComment()
        {
            //Create the comment. This might fail with an error, but it does not matter.
            await VirusTotal.CreateCommentAsync(TestData.TestHash, "VirusTotal.NET test");

            CreateCommentResult comment = await VirusTotal.CreateCommentAsync(TestData.TestHash, "VirusTotal.NET test");

            Assert.Equal(CommentResponseCode.Error, comment.ResponseCode);
            Assert.Equal("Duplicate comment", comment.VerboseMsg);
        }
Esempio n. 5
0
        public async Task C2_outbound(string api_key, string sha1, string upload_to_vt)
        {
            VirusTotal virusTotal = new VirusTotal(api_key);

            virusTotal.UseTLS = true;


            CreateCommentResult comment = await virusTotal.CreateCommentAsync(sha1, upload_to_vt);

            Assert.Equal(CommentResponseCode.Error, comment.ResponseCode);
        }
Esempio n. 6
0
 public async Task CreateEmptyComment()
 {
     await Assert.ThrowsAsync <ArgumentException>(async() => await VirusTotal.CreateCommentAsync(TestData.TestHash, string.Empty));
 }