Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[C# TUT] Make Your Own Windows Form CMD.

DO NOT FLAME 😠
Hi there,
I'm making a series of TUTs that helps you to code a rat in C#.
This code is not using NETWORKING, you have to modify it to work as a part of a rat, I will be there and explain how to modify the codes to form a rat.
It is simple and easy to understand.
Code
//
//  DO NOT RIP THIS AND SAY IT IS YOURS    //
//  Author Morphine Injection    //
//    Www.HackForums.Net    //
//

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace CmdTut
{
    public partial class Form1 : Form
    {
  public Form1()
  {
    InitializeComponent();
  }

  public Process processCmd = new Process();

  private void Form1_Load(object sender, EventArgs e)
  {

    processCmd.StartInfo.FileName = "cmd.exe";
    processCmd.StartInfo.CreateNoWindow = true;
    processCmd.StartInfo.UseShellExecute = false;
    processCmd.StartInfo.RedirectStandardOutput = true;
    processCmd.StartInfo.RedirectStandardInput = true;
    processCmd.StartInfo.RedirectStandardError = true;
    processCmd.OutputDataReceived += new DataReceivedEventHandler(CmdOutputDataHandler);
    processCmd.Start();
    processCmd.BeginOutputReadLine();

  }

  delegate void FillCmdOutputCallBack(string message);

  private void FillCmdOutput(string message)
  {
    if (cmdoutput.InvokeRequired)
    {
    this.Invoke(new FillCmdOutputCallBack(FillCmdOutput), new object[] { message });
    }
    else
    {
    cmdoutput.AppendText(message);
    cmdinput.Focus();
    }
  }

  private void CmdOutputDataHandler(object sendingProcess, DataReceivedEventArgs outLine)
  {

    if (!String.IsNullOrEmpty(outLine.Data))
    {
    try
    {
    FillCmdOutput(outLine.Data + "\r");
    }
    catch (Exception err) { }

    }
  }

  private void cmdinput_KeyDown(object sender, KeyEventArgs e)
  {
    try
    {
    if (e.KeyCode == Keys.Enter)
    {
    processCmd.StandardInput.WriteLine(cmdinput.Text);
    if (cmdinput.Text == "exit")
    Close();
    cmdinput.Text = "";
    }
    }
    catch (Exception err) { }

  }

    }
}

Im doing this for the "HF Coders" group that wont accept me as a member 😠

DOWNLOAD SOURCE CODE 🎉

EDIT : for outputing errors, you can add this code
Code
processCmd.ErrorDataReceived += new DataReceivedEventHandler(CmdOutputDataHandler);
after
Code
processCmd.OutputDataReceived += new DataReceivedEventHandler(CmdOutputDataHandler);
and
Code
processCmd.BeginErrorReadLine();
after
Code
processCmd.BeginOutputReadLine();
Looks nice and works. Some people will probably find this useful.
[x]Written in C - 6KB binary [x]

[Celsius Loader] https://hackforums.net/showthread.php?tid=3238728
Not really important but you can simplify 'catch (Exception err) { }' to 'catch {}' to avoid the warning from never using err.
(Sep 25, 2010 06:30 AM)killerdoob420 Wrote:  Not really important but you can simplify 'catch (Exception err) { }' to 'catch {}' to avoid the warning from never using err.

Yap I can, but in my orignal code i used "err" for bool flags.
And yes it is not realy important, as i said be4 it is a series of TuT's, so I have to go for every single detail
thnx for replying
Orgy is the owner on HF Coders, and he is an asshole some times, because he thinks he is the best at what he does and hes not... he wont accept me into the coder either, but eh who cares, its a group on the computer ( a fucking box) lol.
(Sep 25, 2010 09:53 AM)Zer0Fact0r Wrote:  Your original code, huh? http://www.codeproject.com/KB/IP/Portbin...view=Quick

Asshole.

Any dumbass can get into HF Coders anyways.

Listen dumbass, it is almost 10 lines code so you cant google and see who wrote it first, or who has the copyrights
you cant make copyrights for 1 line on of coding, because if you can
next time beware when your write this
Code
MessageBox.Show("Zer0Fact0r IS A DUMBASS");
cause i have the copyrights for it

btw, it is the standert way to Redirect CMD output,input and errors
because it is in the fucking Process Class

Zer0Fact0r be happy with ur life, it is the only thing you can do,
and continue this series because im going to release the rat code at the end

Hmmm, any more stupid posts like Zer0Fact0r's im going to quit this

btw, i didnt say that code was mine, I should give credit for it to Paul Chin
and this header
//
// DO NOT RIP THIS AND SAY IT IS YOURS //
// Author Morphine Injection //
// Www.HackForums.Net //
//
Is for all of the project

thnx Zer0Fact0r for ur reply 😁
Sorry, RAGEOUT
hf coder group lol :)
i was in it for awhile but that group will have to be one of the most inactive group i've seen so far
Zer0Fact0
STOP THIS USELESS POSTS
if you dont want to learn then dont post or read
This thread targets noobs like you :)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:03 AM 1 298 Sep 24, 2026 10:03 AM
Last Post: Anonynuk
[Shell] by Emre_Jan 12, 2021 11:16 PM 0 141 Jan 12, 2021 11:16 PM
Last Post: Emre_
[C] by Tr0jandogSep 19, 2019 10:47 AM 8 311 Sep 19, 2019 10:47 AM
Last Post: Tr0jandog