mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
ntlm and lm hashes
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -22,6 +22,7 @@ gem 'programr', :git => "http://github.com/robertjwhitney/programr.git"
|
||||
gem 'process_helper'
|
||||
gem 'ovirt-engine-sdk'
|
||||
gem 'duplicate'
|
||||
gem 'smbhash'
|
||||
|
||||
#development only gems go here
|
||||
group :test, :development do
|
||||
|
||||
@@ -84,6 +84,7 @@ GEM
|
||||
rsync (1.0.9)
|
||||
rubyzip (1.2.2)
|
||||
semantic_puppet (1.0.2)
|
||||
smbhash (1.0.2)
|
||||
spidr (0.6.0)
|
||||
nokogiri (~> 1.3)
|
||||
sshkey (1.9.0)
|
||||
@@ -121,6 +122,7 @@ DEPENDENCIES
|
||||
redcarpet
|
||||
rmagick
|
||||
rqrcode
|
||||
smbhash
|
||||
sshkey
|
||||
wordlist
|
||||
yard
|
||||
@@ -128,4 +130,4 @@ DEPENDENCIES
|
||||
zipruby
|
||||
|
||||
BUNDLED WITH
|
||||
1.15.4
|
||||
1.16.1
|
||||
|
||||
@@ -5,6 +5,7 @@ require 'digest'
|
||||
class HashEncoder < StringEncoder
|
||||
attr_accessor :salt
|
||||
attr_accessor :return_salts
|
||||
attr_accessor :salt_position
|
||||
|
||||
def initialize
|
||||
super
|
||||
@@ -12,6 +13,7 @@ class HashEncoder < StringEncoder
|
||||
self.strings_to_encode = []
|
||||
self.salt = []
|
||||
self.return_salts = false
|
||||
self.salt_position = %w(before after).sample
|
||||
end
|
||||
|
||||
def hash_function(str)
|
||||
@@ -21,8 +23,13 @@ class HashEncoder < StringEncoder
|
||||
self.strings_to_encode.each_with_index do |string, i|
|
||||
|
||||
combined_string = string
|
||||
|
||||
if self.salt[i]
|
||||
combined_string += self.salt[i]
|
||||
if salt_position == 'before'
|
||||
combined_string = self.salt[i] + combined_string
|
||||
elsif salt_position == 'after'
|
||||
combined_string = combined_string + self.salt[i]
|
||||
end
|
||||
end
|
||||
|
||||
self.outputs << hash_function(combined_string)
|
||||
@@ -51,8 +58,13 @@ class HashEncoder < StringEncoder
|
||||
end
|
||||
|
||||
def encoding_print_string
|
||||
'strings_to_encode: ' + self.strings_to_encode.to_s + print_string_padding +
|
||||
'salt: ' + self.salt.to_s + print_string_padding +
|
||||
'return_salts: ' + self.return_salts.to_s
|
||||
print_string = 'strings_to_encode: ' + self.strings_to_encode.to_s + print_string_padding +
|
||||
'salt: ' + self.salt.to_s
|
||||
if self.salt.size > 0
|
||||
print_string += print_string_padding
|
||||
print_string += "return_salts: #{self.return_salts.to_s} #{print_string_padding}"
|
||||
print_string += "salt_position: #{self.salt_position.to_s}"
|
||||
end
|
||||
print_string
|
||||
end
|
||||
end
|
||||
0
modules/encoders/hash/lm/lm.pp
Normal file
0
modules/encoders/hash/lm/lm.pp
Normal file
0
modules/encoders/hash/lm/manifests/.no_puppet
Normal file
0
modules/encoders/hash/lm/manifests/.no_puppet
Normal file
16
modules/encoders/hash/lm/secgen_local/local.rb
Normal file
16
modules/encoders/hash/lm/secgen_local/local.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
|
||||
class LMEncoder < HashEncoder
|
||||
def initialize
|
||||
super
|
||||
self.module_name = 'LM Hash Encoder'
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
require 'smbhash'
|
||||
Smbhash.lm_hash(string)
|
||||
end
|
||||
end
|
||||
|
||||
LMEncoder.new.run
|
||||
22
modules/encoders/hash/lm/secgen_metadata.xml
Normal file
22
modules/encoders/hash/lm/secgen_metadata.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<encoder xmlns="http://www.github/cliffe/SecGen/encoder"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.github/cliffe/SecGen/encoder">
|
||||
<name>MD5 Encoder</name>
|
||||
<author>Thomas Shaw</author>
|
||||
<module_license>MIT</module_license>
|
||||
<description>Generates an MD5 hash for each of the strings.</description>
|
||||
|
||||
<type>hash</type>
|
||||
<type>md5</type>
|
||||
<platform>linux</platform>
|
||||
<platform>windows</platform>
|
||||
|
||||
<read_fact>strings_to_encode</read_fact>
|
||||
<read_fact>salt</read_fact>
|
||||
<read_fact>return_salts</read_fact>
|
||||
|
||||
<output_type>string</output_type>
|
||||
|
||||
</encoder>
|
||||
17
modules/encoders/hash/mysql_password/secgen_local/local.rb
Normal file
17
modules/encoders/hash/mysql_password/secgen_local/local.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
|
||||
class MySQLPasswordHashEncoder < HashEncoder
|
||||
def initialize
|
||||
super
|
||||
self.module_name = 'MySQL Password Hash Encoder'
|
||||
self.strings_to_encode = ['right']
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
require 'digest/sha1'
|
||||
"*" + Digest::SHA1.hexdigest(Digest::SHA1.digest(string)).upcase
|
||||
end
|
||||
end
|
||||
|
||||
MySQLPasswordHashEncoder.new.run
|
||||
23
modules/encoders/hash/mysql_password/secgen_metadata.xml
Normal file
23
modules/encoders/hash/mysql_password/secgen_metadata.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<encoder xmlns="http://www.github/cliffe/SecGen/encoder"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.github/cliffe/SecGen/encoder">
|
||||
<name>MySQL Password Hash Encoder</name>
|
||||
<author>Thomas Shaw</author>
|
||||
<module_license>MIT</module_license>
|
||||
<description>Generates a MySQL password hash for each of the strings. '*' + sha1sum(sha1sum(password))</description>
|
||||
|
||||
<type>hash</type>
|
||||
<type>mysql</type>
|
||||
<type>mysql_password</type>
|
||||
<platform>linux</platform>
|
||||
<platform>windows</platform>
|
||||
|
||||
<read_fact>strings_to_encode</read_fact>
|
||||
<read_fact>salt</read_fact>
|
||||
<read_fact>return_salts</read_fact>
|
||||
|
||||
<output_type>string</output_type>
|
||||
|
||||
</encoder>
|
||||
0
modules/encoders/hash/ntlm/manifests/.no_puppet
Normal file
0
modules/encoders/hash/ntlm/manifests/.no_puppet
Normal file
0
modules/encoders/hash/ntlm/ntlm.pp
Normal file
0
modules/encoders/hash/ntlm/ntlm.pp
Normal file
16
modules/encoders/hash/ntlm/secgen_local/local.rb
Normal file
16
modules/encoders/hash/ntlm/secgen_local/local.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
|
||||
class NTLMEncoder < HashEncoder
|
||||
def initialize
|
||||
super
|
||||
self.module_name = 'NTLM Hash Encoder'
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
require 'smbhash'
|
||||
Smbhash.ntlm_hash(string)
|
||||
end
|
||||
end
|
||||
|
||||
NTLMEncoder.new.run
|
||||
22
modules/encoders/hash/ntlm/secgen_metadata.xml
Normal file
22
modules/encoders/hash/ntlm/secgen_metadata.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<encoder xmlns="http://www.github/cliffe/SecGen/encoder"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.github/cliffe/SecGen/encoder">
|
||||
<name>MD5 Encoder</name>
|
||||
<author>Thomas Shaw</author>
|
||||
<module_license>MIT</module_license>
|
||||
<description>Generates an MD5 hash for each of the strings.</description>
|
||||
|
||||
<type>hash</type>
|
||||
<type>md5</type>
|
||||
<platform>linux</platform>
|
||||
<platform>windows</platform>
|
||||
|
||||
<read_fact>strings_to_encode</read_fact>
|
||||
<read_fact>salt</read_fact>
|
||||
<read_fact>return_salts</read_fact>
|
||||
|
||||
<output_type>string</output_type>
|
||||
|
||||
</encoder>
|
||||
0
modules/encoders/hash/sha3/manifests/.no_puppet
Normal file
0
modules/encoders/hash/sha3/manifests/.no_puppet
Normal file
15
modules/encoders/hash/sha3/secgen_local/local.rb
Normal file
15
modules/encoders/hash/sha3/secgen_local/local.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
|
||||
class SHA1Encoder < HashEncoder
|
||||
def initialize
|
||||
super
|
||||
self.module_name = 'SHA1 Encoder'
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
Digest::SHA1.hexdigest(string)
|
||||
end
|
||||
end
|
||||
|
||||
SHA1Encoder.new.run
|
||||
22
modules/encoders/hash/sha3/secgen_metadata.xml
Normal file
22
modules/encoders/hash/sha3/secgen_metadata.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<encoder xmlns="http://www.github/cliffe/SecGen/encoder"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.github/cliffe/SecGen/encoder">
|
||||
<name>SHA1 Encoder</name>
|
||||
<author>Thomas Shaw</author>
|
||||
<module_license>MIT</module_license>
|
||||
<description>Generates an SHA1 hash for each of the strings.</description>
|
||||
|
||||
<type>hash</type>
|
||||
<type>sha1</type>
|
||||
<platform>linux</platform>
|
||||
<platform>windows</platform>
|
||||
|
||||
<read_fact>strings_to_encode</read_fact>
|
||||
<read_fact>salt</read_fact>
|
||||
<read_fact>return_salts</read_fact>
|
||||
|
||||
<output_type>string</output_type>
|
||||
|
||||
</encoder>
|
||||
0
modules/encoders/hash/sha3/sha3.pp
Normal file
0
modules/encoders/hash/sha3/sha3.pp
Normal file
Reference in New Issue
Block a user