Hack Forums
[.NET] [Codecs][C#+VB] Stream Library, Speedup your RemoteDesktop for RAT's and more! - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [Codecs][C#+VB] Stream Library, Speedup your RemoteDesktop for RAT's and more! (/showthread.php?tid=4291058)

Pages: Pages 1 2 3


[Codecs][C#+VB] Stream Library, Speedup your RemoteDesktop for RAT's and more! - DragonHunter - Jun 17, 2014

Hey guys what's up,

I thought of sharing this as I'm quitting the RAT development and focussing at more useful projects.
So what is this StreamLibrary? Well it's a library which contains codecs (or so I call them atleast Codecs) that will convert any image/video into a smaller format
It will compress your video (or Remote Desktop if you will) to a smaller size so it will speed up your remote desktop by ALOT

PS: I'm just taking RAT development as a example because this is HF after all.

This can be used in either C# or VisualBasic .NET.
What most of the people do in RAT development really is sending the image over (compressed hopefully) and that's it,
Or they simply use some motion detection (which is used in the more advanced RAT's) in the hope that it will speedup, which it does.

The codecs I wrote are made for speed and support, you'll find a list below with the features and codecs you're able to use.
The codecs are made for EASY-TO-USE, which means with a stable network you're able to get amazing speed and performance.
Most codecs I wrote are able to handle easily 5760x1080 resolution (which I tested it at) with ~70FPS in speed.

The performance depends at the hardware you're running it at, note: this does not have hardware acceleration

Well ok, after all that talk let's go to the goodies,
Ok so this is just an example of an video running at ~30FPS, encoding it at ~80FPS and decoding it at ~100FPS
This is at a full resolution of 1920x800 !!
[Image: edeffcb75f.png]

Features:
[Driver supported] yes my Unsafe Codecs do support drivers!
[Unsafe Codec support] Use Pointers to gain more performance!
[Managed Codec support] use the managed Bitmap/Image classes
[Multiple Codecs to chose from] There are 5 Unsafe and 6 Managed Codecs
... will write down soon more

So where can you get this? Take a look at my GIT https://github.com/AnguisCaptor/StreamLibrary

Ok so.. you're having the codec library compiled, so now what ?

So first of all, what is the actual codec you want to use ?
If you want it plain and simple you could go for MJPG Codec, which is easy to use and manage but not really a good thing for Remote Desktop and compression but easy to use non the less

So what if I'm having a RAT and I want the best stability and performance ? use the "UnsafeStreamCodec" which I used personally and is really fast
Having a driver ? no problem the "UnsafeStreamCodec" even does support driver-level!

The Different Managed Codecs

DirectDriver Codec:
I barely used this as it was a long time ago, I would have to look at the code/debug again but I guess it does what the name says

MJPG Codec:
This is a very simple MJPG Codec which can even be used for real life situations, webbrowsers etc, It is using the exact same method

QuickCachedStream Codec:
This will cache all the image(s) and trying to quickly process it to keep the performance up, this codec will use cache in the hope to drop ALOT of data to gain higher performance over the internet
Keep in mind that this codec could be unstable or not working correctly, needs more testing

QuickStream Codec:
The name says what it will do, it will quickly stream your images (remote desktop, animations) so fast as possible with plain simple Motion Detection

SmallCachedStream Codec:
This codec is a modified version of the "QuickStreamCodec" but with caching in the hope it will gain performance over the internet

SmallStream Codec:
I don't know exactly what the SmallStream did, I have to look at it again

The Different Unsafe Codecs

UnsafeCache Codec:
I would need to look up what it does again but I'm pretty sure the name explains it all

UnsafeCachedStream Codec:
I would need to look up what it does again but I'm pretty sure the name explains it all

UnsafeOptimized Codec:
It could be stable or not need to test this completely,
But the idea behind this codec is to really optimize the performance for if there are any video's running for example in Remote Desktop
Or specific animations running in the video, it is able to detect multiple video's running in image(s) and to optimize and focus performance at those animation/video's in the image
It sounds complex perhaps, but it will speedup video a little bit if there is any running

UnsafeQuick Stream:
This is an unsafe codec version as the "QuickStreamCodec", I think

UnsafeStream Codec:
This is a very good choice and even RECOMMENDED to use for everything as this is the most stable codec and the most reliable codec I made which supports Drivers and more
It does not contain any caching but yet again, It is really recommended to use over any of the other codecs that are in the library

So how do I even use these codecs ?
The codecs are being made for EASY-TO-USE remember ? well the unsafe codecs are all using the exact same methods and same goes for the Managed codecs

An example of using the Unsafe codec (UnsafeStream Codec):
You really need to understand programming to understand calling a bunch of methods

Ok so this is a example to encode a image to bytes using a codec

PHP Code

<?php 
IUnsafeCodec UnsafeCodec 
= new UnsafeStreamCodec(80); //initialize our Codec
Bitmap bmp = (Bitmap)Bitmap.FromFile("Some file"); // It's just an image, could be of RemoteDesktop, video, anything, it's a image
int width = bmp.Width;
int height = bmp.Height;
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat); //since it's a unsafe codec we need the LockBits to grab the pointer

using (MemoryStream stream = new MemoryStream())
{
    
UnsafeCodec.CodeImage(bmpData.Scan0,
                          new 
Rectangle(0, 0, width, height), //the area of the image to use
                          
new Size(width, height), //give the total size of the image
                          
bmp.PixelFormat, //the format of the image
                          
stream); //where the bytes will be stored in
} 

Ok so the bytes are stored now in "stream" right, now what can be do with the data(bytes) in stream ?
The thing that pops to my mind atleast is sending it over the internet (like remote desktop does in RAT's right...)
And then let's decode the bytes to a image so we're able to see something again 😎

To decode bytes to a image is actually really simple, well how simple ? only 2 lines of code!

PHP Code

<?php 
IUnsafeCodec UnsafeCodec 
= new UnsafeStreamCodec(80); //initialize our Codec
Bitmap DecodedImage = UnsafeCodec.DecodeData(new MemoryStream(YOUR_BYTES_OR_STREAM)); //where is "YOUR_BYTES_OR_STREAM" should be what it says 

And that is how you decode from bytes which was provided by the Encoder, back to an Image again using the Decoder

More technical stuff to keep back in your head:
Ok so when using the Managed/Unsafe codecs you should remember that when using these you need a Encoder and Decoder variable (both initialized ofcourse)
And decoding and encoding in the order you encoded it in

So when doing Encode, you should decode
Wrong example: Don't decode twice the same data! like so
Encoded = Encode(...);
Decoded = Decode(Encoded);
Decoded = Decode(Encoded);

Decoding something twice in a row maybe could cause problem, I did not test this completely but It might will!

I hope I've wrote it detailed enough for people to understand otherwise I would be happy to answer questions,
And please don't bash this thread like "OH THIS COMPLETELY RUINED MY RAT SALE" or like "THE CODE IS HAVING SO MANY BUGS LOLOL"
Some codecs are simply not 100% stable and when you read above about the codecs you know which 1 to use >>UnsafeStream Codec<<
Some of the codecs are simply not 100% finished as it didn't worked out with performance or some other issue
Just enjoy the library and the features it's giving you
Find any bugs ? share them at GIT or simply PM me

Programs/Projects using my StreamLibrary:

Have a good one 🤝


* - Shoсkwave - Jun 17, 2014

The amount of work put in this is phenomenal, I still can't believe you would release something this huge, I hope people give credit when they use this.


* - tweety - Jun 17, 2014

You should have sold this instead of releasing it to a community that would rather abuse it, but won't learn from it. Inb4 20 new RAT's in the market section using this as a base.


* - Nextrum - Jun 17, 2014

I agree with Tweety, this is probably worth quite a bit to the right person. However, this looks phenomenal and I'll look into possibly implementing it into my Movie Streamer app. Keep up the amazing work!


* - TheBarret - Jun 17, 2014

(Jun 17, 2014 12:48 PM)Tweety. Wrote:  You should have sold this instead of releasing it to a community that would rather abuse it, but won't learn from it. Inb4 20 new RAT's in the market section using this as a base.

I kinda agree with Tweetz on this, you could rly make some good deals with this work. However making it public is also very nice.

Pro's mate, good job.


* - Meerkat. - Jun 17, 2014

Wow. This is beyond fucking awesome.


* - Temploit - Jun 17, 2014

(Jun 17, 2014 01:01 PM)Mavamaarten~ Wrote:  Wow. This is beyond fucking awesome.
Couldn't have said it any other way. Amazing job!


* - TheBarret - Jun 17, 2014

(Jun 17, 2014 01:04 PM)Temploit Wrote:  Couldn't have said it any other way. Amazing job!

So it seems the Dutch play good match of football next to having good Dj's, adding "good coders" to the list XD


* - SIM-1676753 - Jun 17, 2014

This is beyond most of the skiddy shit posted here. Awesome release as always!


* - He B TeMy - Jun 17, 2014

This is so good, gonna test it's speed soon !

Thank you !!


* - DragonHunter - Jun 17, 2014

Thanks for the awesome posts 👍👍
I updated the sample project to capture your screen and encode/decode to show how to do it 🤝
At my own pc the GDI Screen Capture is only at ~10FPS, not really the best screen capture for my pc but it never worked great for me 🤣

Atleast the encode/decode is really really fast
Also checkout the resolution I'm testing it with, 2560x1440 🤝
[Image: 85d62b55ae.png]


* - Only3 - Jun 17, 2014

this lib fit hf as its for ppl that cant do / code it by them self look good but i dont like lib's cls's warp's
Good Work on This


* - SIM-1456245 - Jun 17, 2014

Wow this is amazing. But it's not worth it for free. You'll see tomorrow 10 RATs with amazing speeds. You should've sold this.


* - VanToMVB - Jun 17, 2014

That’s Awesome man !!!!!!
can u make a vb.net copy :v ? ????


* - Fgownage - Jun 18, 2014

You know what would be awesome? Heavens gate.