peplum-john 0.2.0 → 0.2.2
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 +4 -4
- data/examples/rest.rb +6 -1
- data/examples/rpc.rb +7 -2
- data/lib/peplum/john/application/payload.rb +19 -10
- data/lib/peplum/john/application/services/info.rb +28 -0
- data/lib/peplum/john/application/services/rest_proxy.rb +19 -0
- data/lib/peplum/john/application.rb +6 -0
- data/lib/peplum/john/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f14dd32ae9417ae6a13bc1343fa0eb530facc0ef42b1a72288e80198ea229a9b
|
4
|
+
data.tar.gz: '0882f77f99ce3f5ea1551c0a80a1873c5225e630c96e2a7e55109efb379972cf'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7febba6d06ad2ead542a9a385e4a6c492e444bde62f970eb43ca60b20ec526d3815fe969354200b2c1dc3440b39298352b425f4ad9516fce02785d834bbbc2c8
|
7
|
+
data.tar.gz: 5901c23f40cc93ab786789a14de96df493a5442dd32e1ec4f5e9dcbdb6d2de231e8c68686919f94c99e31ebae8643b9340a9d0a4a8ea365ce52d88e9f611c01c
|
data/examples/rest.rb
CHANGED
@@ -28,8 +28,10 @@ request :post, 'instances', {
|
|
28
28
|
objects: %w(
|
29
29
|
6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090
|
30
30
|
36f583dd16f4e1e201eb1e6f6d8e35a2ccb3bbe2658de46b4ffae7b0e9ed872e
|
31
|
+
c6b3e5102f268d17a60562720abeb625b0d3398289f46f51861f1bab3055e89d
|
32
|
+
b962ac55407c25c159c4c9f3764145e1ecc9ae6a37cf376e8bc98d31633e9a61
|
31
33
|
),
|
32
|
-
max_workers:
|
34
|
+
max_workers: 4
|
33
35
|
},
|
34
36
|
payload: {
|
35
37
|
format: 'raw-sha256'
|
@@ -40,6 +42,9 @@ request :post, 'instances', {
|
|
40
42
|
instance_id = response_data['id']
|
41
43
|
|
42
44
|
while sleep( 1 )
|
45
|
+
request :get, "instances/#{instance_id}/info/progress"
|
46
|
+
ap response_data
|
47
|
+
|
43
48
|
# Continue looping while instance status is 'busy'.
|
44
49
|
request :get, "instances/#{instance_id}"
|
45
50
|
break if !response_data['busy']
|
data/examples/rpc.rb
CHANGED
@@ -15,8 +15,10 @@ john.run(
|
|
15
15
|
objects: %w(
|
16
16
|
6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090
|
17
17
|
36f583dd16f4e1e201eb1e6f6d8e35a2ccb3bbe2658de46b4ffae7b0e9ed872e
|
18
|
+
c6b3e5102f268d17a60562720abeb625b0d3398289f46f51861f1bab3055e89d
|
19
|
+
b962ac55407c25c159c4c9f3764145e1ecc9ae6a37cf376e8bc98d31633e9a61
|
18
20
|
),
|
19
|
-
max_workers:
|
21
|
+
max_workers: 4
|
20
22
|
},
|
21
23
|
payload: {
|
22
24
|
format: 'raw-sha256'
|
@@ -24,7 +26,10 @@ john.run(
|
|
24
26
|
)
|
25
27
|
|
26
28
|
# Waiting to complete.
|
27
|
-
|
29
|
+
while john.running?
|
30
|
+
ap john.info.progress
|
31
|
+
sleep 1
|
32
|
+
end
|
28
33
|
|
29
34
|
# Hooray!
|
30
35
|
puts JSON.pretty_generate( john.generate_report.data )
|
@@ -8,10 +8,10 @@ class Application
|
|
8
8
|
module Payload
|
9
9
|
|
10
10
|
# For some reason doesn't work when specifying sane directories.
|
11
|
-
HASHES_FILE = "hashes.#{Process.pid}.txt"
|
11
|
+
HASHES_FILE = "hashes.#{rand(99999)}.#{Process.pid}.txt"
|
12
12
|
at_exit { FileUtils.rm_f HASHES_FILE }
|
13
13
|
|
14
|
-
POT_FILE = "hashes.#{Process.pid}.pot"
|
14
|
+
POT_FILE = "hashes.#{rand(99999)}.#{Process.pid}.pot"
|
15
15
|
at_exit { FileUtils.rm_f POT_FILE }
|
16
16
|
|
17
17
|
JOHN = 'john-the-ripper'
|
@@ -85,7 +85,9 @@ module Payload
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
_run options
|
88
|
+
r = _run( options )
|
89
|
+
John::Application.master.info.update r
|
90
|
+
r
|
89
91
|
end
|
90
92
|
|
91
93
|
# Distribute `objects` into `chunks` amount of groups, one for each worker.
|
@@ -94,8 +96,7 @@ module Payload
|
|
94
96
|
# @param [Integer] chunks Amount of object groups that should be generated.
|
95
97
|
#
|
96
98
|
# @return [Array<Array<Object>>] `objects` split in `chunks` amount of groups
|
97
|
-
|
98
|
-
def group( objects, chunks )
|
99
|
+
def split( objects, chunks )
|
99
100
|
objects.chunk chunks
|
100
101
|
end
|
101
102
|
|
@@ -119,15 +120,23 @@ module Payload
|
|
119
120
|
end
|
120
121
|
|
121
122
|
def _run( options )
|
122
|
-
`#{executable} --no-log --pot=#{POT_FILE} --format=#{options['format']} #{HASHES_FILE} 2> /dev/null`
|
123
|
-
|
123
|
+
`#{executable} --no-log --session=#{Process.pid} --pot=#{POT_FILE} --format=#{options['format']} #{HASHES_FILE} 2> /dev/null`
|
124
|
+
self.report
|
125
|
+
end
|
124
126
|
|
127
|
+
def report
|
125
128
|
results = {}
|
129
|
+
|
130
|
+
return results if !File.exists? POT_FILE
|
131
|
+
|
126
132
|
File.open( POT_FILE , 'r' ) do |f|
|
127
|
-
|
128
|
-
|
129
|
-
|
133
|
+
while !f.eof?
|
134
|
+
line = f.readline
|
135
|
+
hash, password = line.split( '$' ).last.split( ':' )
|
136
|
+
results[hash] = password.strip
|
137
|
+
end
|
130
138
|
end
|
139
|
+
|
131
140
|
results
|
132
141
|
end
|
133
142
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Peplum
|
2
|
+
class John
|
3
|
+
class Application
|
4
|
+
module Services
|
5
|
+
|
6
|
+
class Info
|
7
|
+
|
8
|
+
class <<self
|
9
|
+
def progress_data
|
10
|
+
@progress_data ||= {}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def progress
|
15
|
+
self.class.progress_data
|
16
|
+
end
|
17
|
+
|
18
|
+
def update( data )
|
19
|
+
self.class.progress_data.merge! Payload.merge( [self.class.progress_data, data] )
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Peplum
|
2
|
+
class John
|
3
|
+
class Application
|
4
|
+
module Services
|
5
|
+
module RESTProxy
|
6
|
+
def self.registered( app )
|
7
|
+
|
8
|
+
app.get '/progress' do
|
9
|
+
instance_for( params[:instance] ) do |instance|
|
10
|
+
json instance.info.progress
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -11,6 +11,12 @@ class Application < Peplum::Application
|
|
11
11
|
provision_memory 100 * 1024 * 1024
|
12
12
|
provision_disk 100 * 1024 * 1024
|
13
13
|
|
14
|
+
require_relative "application/services/info"
|
15
|
+
instance_service_for :info, Services::Info
|
16
|
+
|
17
|
+
require_relative "application/services/rest_proxy"
|
18
|
+
rest_service_for :info, Services::RESTProxy
|
19
|
+
|
14
20
|
def payload
|
15
21
|
Payload
|
16
22
|
end
|
data/lib/peplum/john/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peplum-john
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tasos Laskos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: peplum
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- lib/peplum/john.rb
|
40
40
|
- lib/peplum/john/application.rb
|
41
41
|
- lib/peplum/john/application/payload.rb
|
42
|
+
- lib/peplum/john/application/services/info.rb
|
43
|
+
- lib/peplum/john/application/services/rest_proxy.rb
|
42
44
|
- lib/peplum/john/version.rb
|
43
45
|
- peplum-john.gemspec
|
44
46
|
homepage: http://ecsypno.com/
|