Lyoto Machida (04-16-2011),Tunguestenio (03-30-2011)
Snippet Name: MPGH: Get Active Users (easy way)
Keywords: N/A
Desctiption: Get Active Users of MPGH, see who is online.
[highlight=vb.net]
'/// Form Load
Webbrowser1.Navigate("https://mpgh.net/forum/")
'Assumes you have added a list box control to add the users to.
'and a hidden webbrowser control
'Clear The List Box so doubles are not added
ListBox1.Items.Clear()
Dim members As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("a")
For Each curElement As HtmlElement In members
' If the attribute Href contains (in the URL) "/members/" (all registered users will) then add the inner text to the list box)
If curElement.GetAttribute("href").Contains("/members/") Then
ListBox1.Items.Add(curElement.GetAttribute("innert ext"))
End If
Next
'Alphabetize the listbox
ListBox1.Sorted = True
'If you would like to see the number of users on, simply count the listbox
'add a label and use the below code
Label1.Text = ListBox1.Items.Count
' You can also check to see if the style attribute contains a specific color and pass that color to the user name to show rank
[/highlight]
Last edited by Jason; 02-15-2011 at 09:35 PM.
Lyoto Machida (04-16-2011),Tunguestenio (03-30-2011)
Computer Information -
Computer Name: My.Computer.Name
User Name: My.User.Name
OS Name: My.Computer.Info.OSFullName
Desktop: My.Computer.Screen.WorkingArea.ToString
Total Physical Memory: My.Computer.Info.TotalPhysicalMemory
Total Virtual Memory:My.Computer.Info.TotalVirtualMemory
Available Virtual Memory: My.Computer.Info.AvailableVirtualMemory
Is 64Bit Process: System.Environment.Is64BitProcess
Download & Run -
Download: My.Computer.Network.DownloadFile("URL here", "Save file as")
Run :Process.start("file name")
Calculator -
This goes at the top of the code between Public Class Form and First Line -
Dim Operation As String = ""
Dim Value1 As double = 0
Dim Value2 double = 0
0 Button -
TextBox1.Text += "0"
Plus -
operation = "Plus"
If CInt(true) then value1 = CDbl(TextBox1.Text)
TextBox1.clear()
Minus -
operation = "Minus"
If CInt(true) then value1 = CDbl(TextBox1.Text)
TextBox1.clear()
Multiply -
operation = "Multiply"
If CInt(true) then value1 = CDbl(TextBox1.Text)
TextBox1.clear()
Divide -
operation = "Divide"
If CInt(true) then value1 = CDbl(TextBox1.Text)
TextBox1.clear()
Point -
Dim dot As boolean
If TextBox1.Text.IndexOf(".") = 0 Then dot = True
if dot = False Then TextBox1.Text += "."
Clear -
TextBox1.Clear()
Equal -
Value2 = Val(TextBox1.Text)
Select Case operation
Case Is = "Plus"
TextBox1.Text = (Value1 + Value2).ToString()
Case Is = "Minus"
TextBox1.Text = (Value1 - Value2).ToString()
Case Is = "Multiply"
TextBox1.Text = (Value1 * Value2).ToString()
Case Is = "Divide"
TextBox1.Text = (Value1 / Value2).ToString()
End Select
MessageBox -
MsgBox("What it will say", MsgBoxStyle.OkOnly, "title")
Note: There are other MsgBoxStyle's
Log In Form -
If TextBox1.Text = "(PASSWORD HERE)" then
(FORM+NUMBER).Show()
Me.Hide()
Else
MessageBox.Show("Wrong PassWord!")
End If
Form Linking to Another -
Form(number).Show()
Me.Hide()
Run a Process -
Process.Start(filename.exe,.txt, etc)
Timer Start + Stop -
Timer1.Start
Timer1.Stop
Progress Bar -
ProgressBar1.Increment(1)
If ProgressBar1.Value = ProgressBar1.Maximum Then
Button1.Enabled = True
__________________
Hello, people of mpgh this is my very simple bookmark source. So easy a caveman could do it.
What is Needed.
- Vb.net
- a brain
- OpenFileDialog
- SaveFileDialog
- a textbox
- 3 buttons
- webbrowser1
Button1Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SaveDialog As New SaveFileDialog SaveDialog.InitialDirectory = My.Computer.FileSystem.CurrentDirectory If SaveDialog.ShowDialog = Windows.Forms.DialogResult.OK Then Using sWrite As New IO.StreamWriter(SaveDialog.FileName) sWrite.WriteLine(TextBox1.Text) End Using End If End SubButton2
Code:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim OFD As New OpenFileDialog OFD.InitialDirectory = My.Computer.FileSystem.CurrentDirectory If OFD.ShowDialog = Windows.Forms.DialogResult.OK Then Using sRead As New IO.StreamReader(OFD.FileName) TextBox1.Text = sRead.ReadLine End Using End If End SubButton3This goes in load formCode:Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click webbrowser1.navigate = textbox1.text End Sub
then when u click save type the name of the bookmark and click save then you use the load to see it, and you can always edit the bookmarks in a text editor.Code:button1.text="Save bookmarks" button2.text="load Bookmarks" button3.text="Navigate"
Last edited by cosconub; 10-24-2010 at 03:46 PM.
~Mohandas GandhiA man is but the product of his thoughts what he thinks, he becomes.
~ ImmortalA Genius is nothing with out an idea, An idea is always an idea even without a genius.
Snippet Name : Open and Save File Dialogs
Keywords : n/a?
Description : Using this basic (but helpful) functions rather than using OpenFileDialog or SaveFileDialog in the toolbox
How does it work?Code:Public Function OpenFileDialog() As String Dim O As New OpenFileDialog O.Title = "Open File" 'Title of your "Open File" Dialog O.Filter = "All Files (*.*)|*.*" 'File Extension O.ShowDialog() 'Shows the dialog Return O.FileName 'If the dialog was cancelled, then it will return as blank End Function Public Function SaveFileDialog() As String Dim S As New SaveFileDialog S.Title = "Save File" 'Title of your "Save File" Dialog S.Filter = "All Files (*.*)|*.*" 'File Extension S.ShowDialog() 'Shows the dialog Return S.FileName 'If the dialog was cancelled, then it will return as blank End Function
Please modify this if there is any corrections.. even this is really basic for a newbie..Code:Me.Text = OpenFileDialog() ' or Me.Text = SaveFileDialog()
Well you do don't need to declare that function for any reason whatsoever. It has no parameters so it's not customizable unless you manually change the title etc, which is what you'd do in a normal declaration of the OFD/SFD. The only way I can see it being useful is something like this:
[highlight=vb.net]
Private Function GetOFD(ByVal title As String, ByVal filter As String) As String
Dim ofd As New OpenFileDialog With {.title = title, .filter = filter}
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
Return ofd.FileName
Else
Return Nothing
End If
End Function
[/highlight]
But still, nice contribution.
Last edited by Jason; 02-15-2011 at 09:35 PM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
nathanael890 (11-21-2010)
Check if a program is running
simple but usefulCode:Public Function ProcessesRunning(ByVal ProcessName As String) As Integer Try Return Process.GetProcessesByName(ProcessName).GetUpperBound(0) + 1 : Catch Return 0 End Try End Function Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If ProcessesRunning("Ccleaner") = 1 Then 'What ever Else 'what ever else End If End Sub
Question ALL statements! ?[img]https://i360.photobucke*****m/albums/oo45/blood188/Untitled-3.jpg?t=1284590977[/img]You're in denial that you're in denial. ?
Well, now per now i'm kinda bored so i decided to get more activity here
How to make a folder....:
[highlight=vb.net] Private Function CreateFolder(ByVal FolderName As String, ByVal StartPath As String) As String
Dim STR As String = New String(FolderName)
If (FolderName Is Nothing) Then
Return Nothing
End If
If STR.Contains(FolderName) Then
System.IO.Directory.CreateDirectory(StartPath & "\" & STR)
End If
Return Nothing
End Function[/highlight]
/Tested
Working 100%
==========================
Check if a file exists and write/read on it....:
[highlight=vb.net] Public Function Write(ByVal filename As String, ByVal WhatToWrite As String)
If Not System.IO.File.Exists(filename) Then
Return Nothing
ElseIf filename Is Nothing Then
Return Nothing
End If
Do While System.IO.File.Exists(filename)
Using Writer As New System.IO.StreamWriter(filename)
Writer.Write(WhatToWrite)
Writer.Close()
End Using
Loop
Return Nothing
End Function[/highlight]
==========================
Gets file's codes....:
[highlight=vb.net] Public Function GetCode(ByVal path As String) As String
Dim str As String = ""
Using sRead As New System.IO.StreamReader(path)
While Not sRead.EndOfStream
str = sRead.ReadToEnd()
End While
End Using
Return str
End Function[/highlight]
==========================
Using Loop....:
[highlight=vb.net] Public Function LoopStat(ByVal add As String) As String
Dim urAge As Integer = 12
Const ret As Integer = 0
Dim lp As Integer = 20
For urAge = 12 To urAge = lp
MsgBox("Your Age Is 20. Happy 20's birthday! ")
Next
Return ret
End Function[/highlight]
==========================
Gets String From A URL......:
[highlight=vb.net] Public WithEvents WebClient1 As New Net.WebClient
Public Function GetString(ByVal address As String) As String
Dim str As String = WebClient1.DownloadString(address)
Return str
End Function[/highlight]
==========================
Gets PC Information......:
[highlight=vb.net] Public Function GetSystemInfo() As String
Dim win As String = My.Computer.Info.OSFullName
Dim virMem As String = My.Computer.Info.TotalVirtualMemory
Dim winVer As String = My.Computer.Info.OSVersion
Return MsgBox("Your Current OS is: " & win _
& vbNewLine _
& "Your OS Version is: " & winVer _
& vbNewLine _
& "Your Total Virtual Memory is: " & virMem)
End Function[/highlight]
==========================
I need to think for more........Hope that those was useful (at least 10% useful )
Regards, Ace.
Last edited by Jason; 02-15-2011 at 09:51 PM.
Tunguestenio (03-30-2011)
Snippet Name : E-Mail Validation Using RegEx
Keywords : Email,Validation,RegEx
Description : Using RegEx to determine if the information in a text box is a valid formated email address.
Code:' Required Imports System.Text.RegularExpressions ' In a button click event (user submission etc.) Dim Valid As Boolean Try 'Textbox1.text is the name of the textbox used in you application, Obvs. Valid = Regex.IsMatch(TextBox1.Text, "\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase) Catch ex As Exception ' Do nothing End Try If Not Valid Then ' Replace with a label or whatever MsgBox("Please Enter a Valid Email Address") TextBox1.Clear() Else ' Remove message box, it is used for testing purposes ' Code to continue here MsgBox("Valid email") End If
Blubb1337 (12-01-2010),mapleanton (10-06-2011),Tunguestenio (03-30-2011)
Snippet Name: Very simple spammer
Keywords: Very, Simple, Spammer
Description: This is just a very simple spammer that opens a internet explorer every milsec (timer.interval is set to 1...)
What you need:
- 1 button (.text - you choose | .name - btnStart)
- 1 timer (.name - tmrSpammer)
- Optionally: 1 label (.text - you choose | .name - lblText)
Code:
When they click on your button (btnStart)
When the button was clicked the timer started and this happensCode:Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click tmrSpammer.Interval = 1 tmrSpammer.Enabled = True End Sub
I made a much complicated spammer, with a gui and stuff, but i'll post it after this (maybe when i get good comments or so... just kidding)Code:Private Sub tmrSpammer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrSpammer.Tick Shell("C:\Program Files\Internet Explorer\iexplorer.exe") End Sub
I know this is very simple but for the starters.. they can learn much about timer and button objects if the whole program is explained
CptnDutch on duty
your code is messing if 2 process is running the function will return 2
correct itCode:If ProcessesRunning("notepad") >= 1 Then
and here is another noob-friendly code
Code:Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If IsProcessRunning("notepad") = True Then label1.Text = "Running" Else label1.Text = "Not Running" End If End Sub Public Function IsProcessRunning(ByVal ProcessName As String) As Boolean If Process.GetProcessesByName(ProcessName).Count >= 1 Then Return True Else Return False End If End Function
Last edited by T0P-CENT; 01-11-2011 at 06:32 AM.
You're right, his code will return the number of open processes with that specific name (GetUpperBound of a process array). Really it should have been a common boolean function, sorta like this maybe?
[highlight=vb.net]
Private Function IsProcessOpen(ByVal processName As String) As Boolean
Dim outputBool As Boolean = False
If Process.GetProcessesByName(processName).Count > 0 Then outputBool = True
Return outputBool
End Function
[/highlight]
Last edited by Jason; 02-15-2011 at 09:51 PM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Note: not sure of the code coz i wrote it on normal notepad then paste
Get All Process Running
add this code in formload event and in button refresh , don't make it in a timerCode:For Each Process In System.Diagnostics .Process.GetProcess Listbox1.Items.Add(Process.ProcessName) Next
__________________________________________________ _____
if you want auto refresh
this basicly get allprocesses for once then it get all items in listbox and check if that item is running or not if it isn't it removes it and it gets also all process again but it don't add it to the listbox and check if thelistbox contains the processCode:Dim GotProcess As Boolean = False Sub GetProcesss() On Error Resume Next If GotProcess = False Then GotProcess = True For Each Process In System.Diagnostics.Process.GetProcesses ListBox1.Items.Add(Process.ProcessName) Next Else For Each Process In System.Diagnostics.Process.GetProcesses If Not ListBox1.Items.Contains(Process.ProcessName) Then ListBox1.Items.Add(Process.ProcessName) End If Next For Each Item As String In ListBox1.Items If Process.GetProcessesByName(Item).Count = 0 Then ListBox1.Items.Remove(Item) End If Next End If End Sub
only one disadvantage: if 2 notepads is running it only say 1 is running
just put in a timer GetProcesss()
Name: Get All Applications Running
__________________________________________________ _________________Code:For Each Process In System.Diagnostics.Process.GetProcesses Listbox1.items.add(Process.MainWindowTittle) Listbox1.items.remove("") Next
Kill A process
Code:Sub KillProcess(Byval ProcessName As String) For Each Process In System.Diagnostics.Process.GetProcessByName(ProcessName) Process.Kill() Next End Sub
Last edited by T0P-CENT; 01-11-2011 at 11:36 AM.
Im bored Heres AQuick Post to help some of ya out!
OpenFile Dialog
SaveFile DialogCode:Dim OpenMe As New OpenFileDialog OpenMe.Filter = "Executable file(*.exe)|*.exe" If OpenMe.ShowDialog = Windows.Forms.DialogResult.OK Then TextBox1.Text = OpenMe.FileName Else MsgBox("Error, please select valid file.", MsgBoxStyle.Critical, "Error") Exit Sub
Font DialogCode:Dim SaveMe As New SaveFileDialog Dim FileLink As String If SaveMe.ShowDialog = Windows.Forms.DialogResult.OK Then FileLink = SaveMe.FileName & ".exe" Else Exit Sub End If
Color DialogCode:Dim Font12 As New FontDialog If Font12.ShowDialog = Windows.Forms.DialogResult.OK Then TextBox1.Font = Font12.Font Else Exit Sub End If
Code:Dim color123 As New ColorDialog If color123.ShowDialog = Windows.Forms.DialogResult.OK Then TextBox1.ForeColor = color123.Color End If
Make The Computer Beep
Fade In / Fade OutCode:Console.Beep()
For Fade OutCode:For Fadein = 0.0 To 1.1 Step 0.1 Me.Opacity = Fadein Me.Refresh() Threading.Thread.Sleep(100) Next
Make The Computer TalkCode:For FadeOut = 90 To 10 Step -10 Me.Opacity = FadeOut / 100 Me.Refresh() Threading.Thread.Sleep(50) Next
Create A Message BoxCode:Dim sapi sapi = CreateObject("sapi.spvoice") sapi.Speak("TextHere")
MessageBox CodesCode:MsgBox("TextHere")
Start a ProcessCode:vbYesNoCancel vbCritical vbExcalmation vbInformation vbMsgBoxHelp vbMsgBoxRight vbOkOnly vbRetryCancel vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbApplicationmodal vbQuestion vbOkCancel vbAbortRetryIgnore
Kill a ProcessCode:Process.Start("notepad")
Rename A FileCode:Dim RunningProcess As System.Diagnostics.Process = Process.GetProcessesByName("taskmgr.exe")(0) RunningProcess.Kill()
Im bored Still Just Posting some useful stuff got from a website i take no credit, something like hackforumns or somethiongCode:My.Computer.FileSystem.RenameFile ("C:\Program Files\Mozilla Firefox\firefox.exe", "Anything.exe")
Last edited by cgallagher21; 01-12-2011 at 12:30 PM.