PART 1

Bikin bot sederhana mengirimkan traffic ke sebuah website. Kita akan belajar tentang proxy dan user agent.

Materi Pendukung

Tutorial Listview : https://www.youtube.com/watch?v=b8cpGeh2yV0&feature=youtu.be

PART 2

Membuat fungsi untuk menambahkan proxy secara otomatis.

MATERI PENDUKUNG PROXY SELENIUM

https://www.youtube.com/watch?v=_qnmy_wbYJg

Materi Pendukung Zip File

https://www.youtube.com/watch?v=hMTXnDJ2FgA

Materi Pendukung File dan Directory

https://www.youtube.com/watch?v=syScIXE1WTY

https://www.youtube.com/watch?v=DTu3I0sPZVw

 

 

Import Module

Imports System.IO
Imports System.IO.Compression

Form Load

 If My.Computer.FileSystem.DirectoryExists("proxy") = False Then My.Computer.FileSystem.CreateDirectory("proxy")

Add Proxy

Dim proxy = "45.140.13.119:9132:usersaya:passwordsaya"

proxy = proxy + ":::"
Dim pcproxy = Split(proxy, ":")
Dim ip = pcproxy(0)
Dim port = pcproxy(1)
Dim user = pcproxy(2)
Dim password = pcproxy(3)

'======== File manifest.json =========
Dim manifest = "
{
""version"": ""1.0.0"",
""manifest_version"": 2,
""name"": """ + ip + """,
""permissions"": [
""proxy"",
""tabs"",
""unlimitedStorage"",
""storage"",
"""",
""webRequest"",
""webRequestBlocking""
],
""background"": {
""scripts"": [""background.js""]
},
""minimum_chrome_version"":""22.0.0""
}"

'======== background.js =========

Dim backgrond = "var config = {
mode: ""fixed_servers"",
rules: {
  singleProxy: {
	scheme: ""http"",
	host: """ + ip + """,
	port: parseInt(" + port + ")
  },
  bypassList: [""localhost""]
}
};

chrome.proxy.settings.set({value: config, scope: ""regular""}, function() {});

function callbackFn(details) {
return {
authCredentials: {
	username: """ + user + """,
	password: """ + password + """
}
};
}

chrome.webRequest.onAuthRequired.addListener(
	callbackFn,
	{urls: [""""]},
	['blocking']
);"


'============= Membuat mainfest.jsonn dan background.js ===============
My.Computer.FileSystem.WriteAllText("proxy/manifest.json", manifest, False)
My.Computer.FileSystem.WriteAllText("proxy/background.js", backgrond, False)


Using zip = ZipFile.Open("proxy/" + ip + ".zip", ZipArchiveMode.Create)
	'====== Mengcopy data dari background.js ==========
	Dim entry1 = zip.CreateEntry("background.js")
	entry1.LastWriteTime = DateTimeOffset.Now
	Using stream = File.OpenRead("proxy/background.js")
		Using entryStream = entry1.Open
			stream.CopyTo(entryStream)
		End Using
	End Using

	'====== Mengcopy data dari manifest.json ==========
	Dim entry2 = zip.CreateEntry("manifest.json")
	entry2.LastWriteTime = DateTimeOffset.Now
	Using stream = File.OpenRead("proxy//manifest.json")
		Using entryStream = entry2.Open
			stream.CopyTo(entryStream)
		End Using
	End Using

End Using

'============= Hapus mainfest.jsonn dan background.js ===============
My.Computer.FileSystem.DeleteFile("proxy/manifest.json")
My.Computer.FileSystem.DeleteFile("proxy/background.js")

PART 3

Setup Proxy mengambil data dari textbox

MATERI PENDUKUNG Looping

https://www.youtube.com/watch?v=mk0saIYF_wM

Materi Pendukung TextBox

https://www.youtube.com/watch?v=pR74NWIdaME

Materi Pendukung Background Worker

https://www.youtube.com/watch?v=H1TG6rjyG68

 

 

Form Load

 BackgroundWorker1.WorkerSupportsCancellation = True

Button Add

Try
	BackgroundWorker1.RunWorkerAsync()
Catch ex As Exception
	MsgBox("Error Eksekusi")
End Try

Background Worker

Dim allproxy
TextBox1.Invoke(Sub() allproxy = TextBox1.Lines)
TextBox1.Invoke(Sub() TextBox1.Enabled = False)
For Each proxy In allproxy
	'IP:PORT:USER:PASSWORD
	'IP:PORT::
	'Dim proxy = "45.140.13.119:9132:usersaya:passwordsaya"
	If Trim(proxy) <> "" Then
		proxy = proxy + ":::"
		Dim pcproxy = Split(proxy, ":")
		Dim ip = pcproxy(0)
		Dim port = pcproxy(1)
		Dim user = pcproxy(2)
		Dim password = pcproxy(3)
		'======== File manifest.json =========
		Dim manifest = "
{
""version"": ""1.0.0"",
""manifest_version"": 2,
""name"": """ + ip + """,
""permissions"": [
""proxy"",
""tabs"",
""unlimitedStorage"",
""storage"",
"""",
""webRequest"",
""webRequestBlocking""
],
""background"": {
""scripts"": [""background.js""]
},
""minimum_chrome_version"":""22.0.0""
}"

		'======== background.js =========

		Dim backgrond = "var config = {
mode: ""fixed_servers"",
rules: {
  singleProxy: {
	scheme: ""http"",
	host: """ + ip + """,
	port: parseInt(" + port + ")
  },
  bypassList: [""localhost""]
}
};

chrome.proxy.settings.set({value: config, scope: ""regular""}, function() {});

function callbackFn(details) {
return {
authCredentials: {
	username: """ + user + """,
	password: """ + password + """
}
};
}

chrome.webRequest.onAuthRequired.addListener(
	callbackFn,
	{urls: [""""]},
	['blocking']
);"


		'============= Membuat mainfest.jsonn dan background.js ===============
		My.Computer.FileSystem.WriteAllText("proxy/manifest.json", manifest, False)
		My.Computer.FileSystem.WriteAllText("proxy/background.js", backgrond, False)


		Using zip = ZipFile.Open("proxy/" + ip + ".zip", ZipArchiveMode.Create)
			'====== Mengcopy data dari background.js ==========
			Dim entry1 = zip.CreateEntry("background.js")
			entry1.LastWriteTime = DateTimeOffset.Now
			Using stream = File.OpenRead("proxy/background.js")
				Using entryStream = entry1.Open
					stream.CopyTo(entryStream)
				End Using
			End Using

			'====== Mengcopy data dari manifest.json ==========
			Dim entry2 = zip.CreateEntry("manifest.json")
			entry2.LastWriteTime = DateTimeOffset.Now
			Using stream = File.OpenRead("proxy//manifest.json")
				Using entryStream = entry2.Open
					stream.CopyTo(entryStream)
				End Using
			End Using

		End Using

		'============= Hapus mainfest.jsonn dan background.js ===============
		My.Computer.FileSystem.DeleteFile("proxy/manifest.json")
		My.Computer.FileSystem.DeleteFile("proxy/background.js")
	End If
Next
TextBox1.Invoke(Sub() TextBox1.Enabled = True)
TextBox1.Invoke(Sub() TextBox1.Text = "")
BackgroundWorker1.CancelAsync()
BeginInvoke(Sub() Me.Close())

PART 4

Menampilkan Proxy ke List view

MATERI PENDUKUNG Looping

https://www.youtube.com/watch?v=mk0saIYF_wM

Materi Pendukung File dan Directory

https://www.youtube.com/watch?v=syScIXE1WTY

https://www.youtube.com/watch?v=DTu3I0sPZVw

Fungsi show proxy

 Function showProxy()
	ListView1.Items.Clear()
	For Each file In My.Computer.FileSystem.GetFiles("proxy")
		Dim fname = Split(file, "\").Last
		fname = Replace(fname, ".zip", "")
		Dim item = ListView1.Items.Add(fname)
	Next
	Return True
End Function