Advertisement
ps66uk

PS-Extract-URL001

Jan 15th, 2019
1,444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <# This form was created using POSHGUI.com  a free online gui designer for PowerShell
  2. .NAME
  3.     Extract-URL001.ps1
  4. #>
  5.  
  6. Add-Type -AssemblyName System.Windows.Forms
  7. [System.Windows.Forms.Application]::EnableVisualStyles()
  8.  
  9. $Form                            = New-Object system.Windows.Forms.Form
  10. $Form.ClientSize                 = '800,400'
  11. $Form.text                       = "Form"
  12. $Form.TopMost                    = $false
  13.  
  14. $TextBox1                        = New-Object system.Windows.Forms.TextBox
  15. $TextBox1.multiline              = $true
  16. $TextBox1.width                  = 780
  17. $TextBox1.height                 = 130
  18. $TextBox1.location               = New-Object System.Drawing.Point(14,31)
  19. $TextBox1.Font                   = 'Microsoft Sans Serif,8'
  20.  
  21. $TextBox2                        = New-Object system.Windows.Forms.TextBox
  22. $TextBox2.multiline              = $true
  23. $TextBox2.width                  = 780
  24. $TextBox2.height                 = 118
  25. $TextBox2.location               = New-Object System.Drawing.Point(14,207)
  26. $TextBox2.Font                   = 'Microsoft Sans Serif,10'
  27.  
  28. $Label1                          = New-Object system.Windows.Forms.Label
  29. $Label1.text                     = "Command string"
  30. $Label1.AutoSize                 = $true
  31. $Label1.width                    = 25
  32. $Label1.height                   = 10
  33. $Label1.location                 = New-Object System.Drawing.Point(19,9)
  34. $Label1.Font                     = 'Microsoft Sans Serif,10'
  35.  
  36. $Label2                          = New-Object system.Windows.Forms.Label
  37. $Label2.text                     = "URLs"
  38. $Label2.AutoSize                 = $true
  39. $Label2.width                    = 25
  40. $Label2.height                   = 10
  41. $Label2.location                 = New-Object System.Drawing.Point(20,185)
  42. $Label2.Font                     = 'Microsoft Sans Serif,10'
  43.  
  44. $Form.controls.AddRange(@($TextBox1,$TextBox2,$Label1,$Label2))
  45.  
  46. $TextBox1.Add_TextChanged({ AddCMD })
  47.  
  48. function AddCMD {
  49.  
  50.  
  51. #Write your logic code here
  52.  
  53. $cmd_string = $TextBox1.text
  54.  
  55. $output = $cmd_string
  56.  
  57. $sub_group = ':(.*=.*)!'
  58. $url   = "((http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#]/*)?)"
  59.  
  60. $cmd_string2 = $cmd_string.Split('&')
  61.  
  62. switch -Regex ($cmd_string2) {
  63.  
  64.     $sub_group {$output = $output.Replace($matches[1].Split('=')[0], $matches[1].Split('=')[1])}
  65.  
  66. }
  67.  
  68. switch -Regex ($output.split('@')) {
  69.  
  70.     $url {$urls += ($matches[0] + "`r`n")}
  71.  
  72. }
  73.  
  74. $TextBox2.text = $urls
  75.  
  76. }
  77. [void]$Form.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement