Ubuntu Pastebin

Paste from gz at Tue, 7 Jul 2015 14:36:39 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
=== modified file 'remote.py'
--- remote.py	2015-07-02 00:59:47 +0000
+++ remote.py	2015-07-07 14:36:12 +0000
@@ -183,22 +183,32 @@
     $in.Close()
 }
 
-ForEach ($pattern in %s) {
-    $path = [Environment]::ExpandEnvironmentVariables($pattern)
-    $files = Get-Item -path $path
-    ForEach ($file in $files) {
-        [Console]::Out.Write($file.name + "|")
-        $trans = New-Object Security.Cryptography.ToBase64Transform
-        $out = [Console]::OpenStandardOutput()
-        $bs = New-Object Security.Cryptography.CryptoStream($out, $trans,
-            [Security.Cryptography.CryptoStreamMode]::Write)
-        $zs = New-Object IO.Compression.DeflateStream($bs,
-            [IO.Compression.CompressionMode]::Compress)
-        CopyBinary -file $file -outstream $zs
-        $zs.Close()
-        [Console]::Out.Write("\n")
+function GatherFiles {
+    param([String[]]$patterns)
+    ForEach ($pattern in %s) {
+        $path = [Environment]::ExpandEnvironmentVariables($pattern)
+        $files = Get-Item -path $path
+        ForEach ($file in $files) {
+            [Console]::Out.Write($file.name + "|")
+            $trans = New-Object Security.Cryptography.ToBase64Transform
+            $out = [Console]::OpenStandardOutput()
+            $bs = New-Object Security.Cryptography.CryptoStream($out, $trans,
+                [Security.Cryptography.CryptoStreamMode]::Write)
+            $zs = New-Object IO.Compression.DeflateStream($bs,
+                [IO.Compression.CompressionMode]::Compress)
+            CopyBinary -file $file -outstream $zs
+            $zs.Close()
+            [Console]::Out.Write("\n")
+        }
     }
 }
+
+try {
+    GatherFiles -pattern %s -ErrorAction Stop
+} catch {
+    Write-Error $_
+    exit 1
+}
 """
 
 
Download as text