ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!

Jump to content



Photo

[Help] C# Threading


  • Please log in to reply
[Help] C# Threading

#1

Ollori
Ollori
    Offline
    634
    Rep
    1205
    Likes

    Not An Anime Company

Posts: 2722
Threads: 794
Joined: Jan 14, 2017
Credits: 0

Seven years registered
#1

I'm not really familiar with threading and it's confusing me on how to make like a cracker

Basically, I have the "one threaded cracker" that I made and I can't figure out how to make it multi threaded where it picks lines from an (array string? / list)

Any informations would be useful, thanks in advnace

 

If you're too lazy to type, just link me some webpage & I'll understand it easily


  • 0

Please always send me a PM before dealing with me, some people are impersonating me on Discord.


#2

LLllLLlLlIiiIIi
LLllLLlLlIiiIIi
    Offline
    258
    Rep
    422
    Likes

    Veteran

Posts: 571
Threads: 168
Joined: Mar 22, 2019
Credits: 0

Deal with caution
User has an open scam report.
Five years registered
#2

 

I'm not really familiar with threading and it's confusing me on how to make like a cracker

Basically, I have the "one threaded cracker" that I made and I can't figure out how to make it multi threaded where it picks lines from an (array string? / list)

Any informations would be useful, thanks in advnace

 

If you're too lazy to type, just link me some webpage & I'll understand it easily

 

http://www.albahari.com/threading/

https://www.tutorial...tithreading.htm

https://www.pluralsi...lication-with-c

 

Basic info about multi threading. I could go in to detail, as I have made checkers that have 10k cpm because of threading, but It is to long to explain. 


  • 1

#3

Ollori
Ollori
    Offline
    634
    Rep
    1205
    Likes

    Not An Anime Company

Posts: 2722
Threads: 794
Joined: Jan 14, 2017
Credits: 0

Seven years registered
#3

Basic info about multi threading. I could go in to detail, as I have made checkers that have 10k cpm because of threading, but It is to long to explain. 

Hey that's useful, thank you, however, I was wondering, how do you assign a part of a combolist to it? I usually just do foreach line in an array, that's whats confusing me the most


  • 0

Please always send me a PM before dealing with me, some people are impersonating me on Discord.


#4

Psy
Psy
    Offline
    62
    Rep
    355
    Likes

    Godtier

  • PipPipPipPipPipPipPip
Posts: 768
Threads: 44
Joined: Jan 30, 2015
Credits: 0

Deal with caution
User has an open scam report.
Eight years registered
#4

Hey that's useful, thank you, however, I was wondering, how do you assign a part of a combolist to it? I usually just do foreach line in an array, that's whats confusing me the most

Threads are generally for system side duties.

 

You want Parallels. You can use Parallels just like how you were talking about your foreach loop, but I prefer for loops :) An example:

Console.WriteLine("Amount of threads: ");
string amntStr = Console.ReadLine();
int amnt = Convert.ToInt32(amntStr);
string[] combos = File.ReadAllLines(AppDomain.CurrentDomain.BaseDirectory + "combo.txt");

Parallel.For(0, combos.Length, new ParallelOptions() { MaxDegreeOfParallelism = amnt }, l =>
{
    Console.WriteLine(amnt);
    Console.WriteLine(combos[l]);
});

You can control amount of "threads" with MaxDegreeOfParallelism :)


  • 1

Add on discord: Psy#0001




There are impersonators! Psy#5792 and Psy#8130


#5

Ollori
Ollori
    Offline
    634
    Rep
    1205
    Likes

    Not An Anime Company

Posts: 2722
Threads: 794
Joined: Jan 14, 2017
Credits: 0

Seven years registered
#5

Threads are generally for system side duties.
 

Thank you so much, guess I can call it solved now :wub:

  • 0

Please always send me a PM before dealing with me, some people are impersonating me on Discord.


#6

IceyTroll
IceyTroll
    Offline
    5
    Rep
    40
    Likes

    -.-. ..- -. -

Posts: 50
Threads: 9
Joined: Aug 03, 2015
Credits: 0

Eight years registered
#6

I would highly recommend you to check out Task since it's alot easier to use with asynchronous operations. I have used it with almost every cracker i have built for the last 3-4 years.


Edited by zcaverz, 09 April 2019 - 11:30 AM.

  • 0

#7

Psy
Psy
    Offline
    62
    Rep
    355
    Likes

    Godtier

  • PipPipPipPipPipPipPip
Posts: 768
Threads: 44
Joined: Jan 30, 2015
Credits: 0

Deal with caution
User has an open scam report.
Eight years registered
#7

I would highly recommend you to check out Task since it's alot easier to use with asynchronous operations. I have used it with almost every cracker i have built for the last 3-4 years.

In my experience Tasks are very CPU intensive.

 

You can wrap parellels in a task.

Task t = Task.Run(() =>
{
    Parallel.For(x, x, new x() { x }, l =>
    {
        //do work
    });
});

  • 1

Add on discord: Psy#0001




There are impersonators! Psy#5792 and Psy#8130


#8

IceyTroll
IceyTroll
    Offline
    5
    Rep
    40
    Likes

    -.-. ..- -. -

Posts: 50
Threads: 9
Joined: Aug 03, 2015
Credits: 0

Eight years registered
#8

 

In my experience Tasks are very CPU intensive.

 

You can wrap parellels in a task.

Task t = Task.Run(() =>
{
    Parallel.For(x, x, new x() { x }, l =>
    {
        //do work
    });
});

Well that would depend on how you use your Task. I can run around 10-20k Tasks at the same time and it won't even take 100MB of my CPU.
Althought it can eat alot of RAM insteed. Haven't used Parallel so can't really give my 2 cents on it.

From my understanding so is the biggest diffrence that Tasks run without waiting and Parallel will wait.

Edit:
Here is a quick PoC should run but i just wrote it from memory so haven't tested it. Although this is not even near the best way to write a async task running process.
You should also set a limit on how many Tasks that is allowed to run at the same time which i have not done in this one.

List<Task> tasks = new List<Task>();
            int tasksTested = 0;
            int maxTasks = 10000;
            for (int startedTasks = 0; startedTasks < maxTasks; startedTasks++)
            {
                tasks.Add(
                    Task.Run(() =>
                    {
                        tasksTested++;
                        Console.WriteLine("Started task " + tasksTested);
                        Thread.Sleep(50); //Remove this and it will probably max out the CPU
                        Console.WriteLine("Ended task " + tasksTested);
                    })
                );
                Thread.Sleep(1);
            }
            Task.WaitAll(tasks.ToArray());
            Console.ReadLine();

  • 0

#9

Saika
Saika
    Offline
    12
    Rep
    153
    Likes

    Professional Reverser

Posts: 157
Threads: 7
Joined: Oct 10, 2017
Credits: 0

Six years registered
#9

 

In my experience Tasks are very CPU intensive.

 

You can wrap parellels in a task.

Task t = Task.Run(() =>
{
    Parallel.For(x, x, new x() { x }, l =>
    {
        //do work
    });
});

I haven't touched on this topic in a while but I feel like I remember that Tasks execute quicker than a Parallel loop, to the OP, I'd recommend taking both approaches and seeing what fits you best, also check the performance differences with dotMemory and dotTrace


  • 0

programmer/reverser/cracker for hire

BTC: 1LLm4gaPYCZsczmi8n1ia1GsEMsDRs2ayy ETH: 0x7d8045F6e452045439c831D09BAB19Bf9D5263EE


#10

Ollori
Ollori
    Offline
    634
    Rep
    1205
    Likes

    Not An Anime Company

Posts: 2722
Threads: 794
Joined: Jan 14, 2017
Credits: 0

Seven years registered
#10

I haven't touched on this topic in a while but I feel like I remember that Tasks execute quicker than a Parallel loop, to the OP, I'd recommend taking both approaches and seeing what fits you best, also check the performance differences with dotMemory and dotTrace

 

I would highly recommend you to check out Task since it's alot easier to use with asynchronous operations. I have used it with almost every cracker i have built for the last 3-4 years.

 

 

In my experience Tasks are very CPU intensive.

 

Thanks for all of your replies boys <3


  • 0

Please always send me a PM before dealing with me, some people are impersonating me on Discord.



 Users browsing this thread: