Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <# This form was created using POSHGUI.com a free online gui designer for PowerShell
- .NAME
- Extract-URL001.ps1
- #>
- Add-Type -AssemblyName System.Windows.Forms
- [System.Windows.Forms.Application]::EnableVisualStyles()
- $Form = New-Object system.Windows.Forms.Form
- $Form.ClientSize = '800,400'
- $Form.text = "Form"
- $Form.TopMost = $false
- $TextBox1 = New-Object system.Windows.Forms.TextBox
- $TextBox1.multiline = $true
- $TextBox1.width = 780
- $TextBox1.height = 130
- $TextBox1.location = New-Object System.Drawing.Point(14,31)
- $TextBox1.Font = 'Microsoft Sans Serif,8'
- $TextBox2 = New-Object system.Windows.Forms.TextBox
- $TextBox2.multiline = $true
- $TextBox2.width = 780
- $TextBox2.height = 118
- $TextBox2.location = New-Object System.Drawing.Point(14,207)
- $TextBox2.Font = 'Microsoft Sans Serif,10'
- $Label1 = New-Object system.Windows.Forms.Label
- $Label1.text = "Command string"
- $Label1.AutoSize = $true
- $Label1.width = 25
- $Label1.height = 10
- $Label1.location = New-Object System.Drawing.Point(19,9)
- $Label1.Font = 'Microsoft Sans Serif,10'
- $Label2 = New-Object system.Windows.Forms.Label
- $Label2.text = "URLs"
- $Label2.AutoSize = $true
- $Label2.width = 25
- $Label2.height = 10
- $Label2.location = New-Object System.Drawing.Point(20,185)
- $Label2.Font = 'Microsoft Sans Serif,10'
- $Form.controls.AddRange(@($TextBox1,$TextBox2,$Label1,$Label2))
- $TextBox1.Add_TextChanged({ AddCMD })
- function AddCMD {
- #Write your logic code here
- $cmd_string = $TextBox1.text
- $output = $cmd_string
- $sub_group = ':(.*=.*)!'
- $url = "((http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#]/*)?)"
- $cmd_string2 = $cmd_string.Split('&')
- switch -Regex ($cmd_string2) {
- $sub_group {$output = $output.Replace($matches[1].Split('=')[0], $matches[1].Split('=')[1])}
- }
- switch -Regex ($output.split('@')) {
- $url {$urls += ($matches[0] + "`r`n")}
- }
- $TextBox2.text = $urls
- }
- [void]$Form.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement