modules/illScrappy/metasploit-framework/modules/encoders/r3Evolve.rb
def splash_effect()
				def grab_random_bytes()
					def get_byte_array()
						gba = lambda {return ([$r.rand(0..255)].pack("V*").gsub /\000*$/,'').unpack("H*").join}
						junk_count = $r.rand(($sm*$mult).to_i..$sm).to_i
						count = 0
						junk_array = []
						until junk_count == count
							new_byte = gba.call
							if $badchars.index(new_byte) == nil
								junk_array.push(new_byte)
							end
							count += 1
						end
						return junk_array,junk_count
					end
					count = 0
					count_max = 8 # higher count means higher accuracy but longer loading time
					junk_array,junk_count = get_byte_array
					#while junk_count > 70 and junk_count < 135 # dead zone
					#	junk_count = $r.rand(($sm*$mult).to_i..$sm)
					#end
					until count > count_max
						count += 1
						if junk_array.uniq.length + $badchars.length != (junk_array + $badchars).uniq.length
							junk_array,junk_count = get_byte_array
							count = 0
						end
					end

					junk_ar_join = junk_array.join
					junk_ar_len = junk_array.length
					if junk_count < 128
						junk_dis = ([junk_ar_len].pack("V*").gsub /\000*$/,'').unpack("H*").join
					else
						junk_dis = ([junk_ar_len].pack("V*")).unpack("H*").join
					end
					return junk_array,junk_count,junk_ar_join,junk_ar_len,junk_dis
				end

				junk_ar,junk_count,junk_ar_join,junk_ar_len,junk_dis = grab_random_bytes()

				restart = true
				count = 0
				max_count = ($ric*2) # times 2 becuse here you are 2x as likely to fail.
				while restart == true and count < max_count
					restart = false
					if junk_count < 128
						## yes, this re-enforcement is necessary, ruby isn't always reliable
						if junk_dis.to_i(16) != junk_ar_len \
							or junk_dis.to_i(16) != junk_count \
							or junk_dis.to_i(16) != junk_ar_join.length/2 \
							or junk_ar_join.length/2 != junk_count \
							or [junk_dis + '000000'].pack("H*").unpack("V*").join.to_i != junk_ar_len \
							or [junk_dis + '000000'].pack("H*").unpack("V*").join.to_i != junk_count \
							or [junk_dis + '000000'].pack("H*").unpack("V*").join.to_i != junk_ar_join.length/2
							restart = true
						end
						jmp_junk = "eb"+junk_dis+junk_ar_join
					else
						## yes, this re-enforcement is necessary, ruby isn't always reliable
						if [junk_dis].pack("H*").unpack("V*").join.to_i != junk_ar_len or junk_ar_len != junk_count \
							or [junk_dis].pack("H*").unpack("V*").join.to_i != junk_count \
							or [junk_dis].pack("H*").unpack("V*").join.to_i != junk_ar_join.length/2 \
							or junk_dis.scan(/../).reverse.join.to_i(16) != [junk_dis].pack("H*").unpack("V*").join.to_i \
							or junk_dis.scan(/../).reverse.join.to_i(16) != junk_ar_len \
							or junk_dis.scan(/../).reverse.join.to_i(16) != junk_ar_join.length/2
							restart = true
						end
						jmp_junk = "e9"+junk_dis+junk_ar_join
					end

					if restart == true or ((junk_dis.scan(/../))+$badchars).uniq.length != ((junk_dis.scan(/../)).uniq).length + $badchars.uniq.length
						count = 0
						junk_ar,junk_count,junk_ar_join,junk_ar_len,junk_dis = grab_random_bytes()
					else
						count += 1
					end
				end

				return [jmp_junk].pack("H*")
			end
# get lambda here to grab our automatic regs
get lambda here to grab our automatic regs
get lambda here to grab our automatic regs
def splash_effect()
				def grab_random_bytes()
					def get_byte_array()
						gba = lambda {return ([$r.rand(0..255)].pack("V*").gsub /\000*$/,'').unpack("H*").join}
						junk_count = $r.rand(($sm*$mult).to_i..$sm).to_i
						count = 0
						junk_array = []
						until junk_count == count
							new_byte = gba.call
							if $badchars.index(new_byte) == nil
								junk_array.push(new_byte)
							end
							count += 1
						end
						return junk_array,junk_count
					end
					count = 0
					count_max = 8 
					junk_array,junk_count = get_byte_array
					until count > count_max
						count += 1
						if junk_array.uniq.length + $badchars.length != (junk_array + $badchars).uniq.length
							junk_array,junk_count = get_byte_array
							count = 0
						end
					end
					junk_ar_join = junk_array.join
					junk_ar_len = junk_array.length
					if junk_count < 128
						junk_dis = ([junk_ar_len].pack("V*").gsub /\000*$/,'').unpack("H*").join
					else
						junk_dis = ([junk_ar_len].pack("V*")).unpack("H*").join
					end
					return junk_array,junk_count,junk_ar_join,junk_ar_len,junk_dis
				end
				junk_ar,junk_count,junk_ar_join,junk_ar_len,junk_dis = grab_random_bytes()
				restart = true
				count = 0
				max_count = ($ric*2) 
				while restart == true and count < max_count
					restart = false
					if junk_count < 128
						if junk_dis.to_i(16) != junk_ar_len \
							or junk_dis.to_i(16) != junk_count \
							or junk_dis.to_i(16) != junk_ar_join.length/2 \
							or junk_ar_join.length/2 != junk_count \
							or [junk_dis + '000000'].pack("H*").unpack("V*").join.to_i != junk_ar_len \
							or [junk_dis + '000000'].pack("H*").unpack("V*").join.to_i != junk_count \
							or [junk_dis + '000000'].pack("H*").unpack("V*").join.to_i != junk_ar_join.length/2
							restart = true
						end
						jmp_junk = "eb"+junk_dis+junk_ar_join
					else
						if [junk_dis].pack("H*").unpack("V*").join.to_i != junk_ar_len or junk_ar_len != junk_count \
							or [junk_dis].pack("H*").unpack("V*").join.to_i != junk_count \
							or [junk_dis].pack("H*").unpack("V*").join.to_i != junk_ar_join.length/2 \
							or junk_dis.scan(/../).reverse.join.to_i(16) != [junk_dis].pack("H*").unpack("V*").join.to_i \
							or junk_dis.scan(/../).reverse.join.to_i(16) != junk_ar_len \
							or junk_dis.scan(/../).reverse.join.to_i(16) != junk_ar_join.length/2
							restart = true
						end
						jmp_junk = "e9"+junk_dis+junk_ar_join
					end
					if restart == true or ((junk_dis.scan(/../))+$badchars).uniq.length != ((junk_dis.scan(/../)).uniq).length + $badchars.uniq.length
						count = 0
						junk_ar,junk_count,junk_ar_join,junk_ar_len,junk_dis = grab_random_bytes()
					else
						count += 1
					end
				end
				return [jmp_junk].pack("H*")
			end
def splash_effect ( ) def grab_random_bytes ( ) def get_byte_array ( ) gba = lambda { return ( [ $r . rand ( 0 .. 255 ) ] . pack ( "V*" ) . gsub / \000 *$ / , '' ) . unpack ( "H*" ) . join } junk_count = $r . rand ( ( $sm * $mult ) . to_i .. $sm ) . to_i count = 0 junk_array = [ ] until junk_count == count new_byte = gba . call if $badchars . index ( new_byte ) == nil junk_array . push ( new_byte ) end count += 1 end return junk_array , junk_count end count = 0 count_max = 8 junk_array , junk_count = get_byte_array until count > count_max count += 1 if junk_array . uniq . length + $badchars . length != ( junk_array + $badchars ) . uniq . length junk_array , junk_count = get_byte_array count = 0 end end junk_ar_join = junk_array . join junk_ar_len = junk_array . length if junk_count < 128 junk_dis = ( [ junk_ar_len ] . pack ( "V*" ) . gsub / \000 *$ / , '' ) . unpack ( "H*" ) . join else junk_dis = ( [ junk_ar_len ] . pack ( "V*" ) ) . unpack ( "H*" ) . join end return junk_array , junk_count , junk_ar_join , junk_ar_len , junk_dis end junk_ar , junk_count , junk_ar_join , junk_ar_len , junk_dis = grab_random_bytes ( ) restart = true count = 0 max_count = ( $ric * 2 ) while restart == true and count < max_count restart = false if junk_count < 128 if junk_dis . to_i ( 16 ) != junk_ar_len or junk_dis . to_i ( 16 ) != junk_count or junk_dis . to_i ( 16 ) != junk_ar_join . length / 2 or junk_ar_join . length / 2 != junk_count or [ junk_dis + '000000' ] . pack ( "H*" ) . unpack ( "V*" ) . join . to_i != junk_ar_len or [ junk_dis + '000000' ] . pack ( "H*" ) . unpack ( "V*" ) . join . to_i != junk_count or [ junk_dis + '000000' ] . pack ( "H*" ) . unpack ( "V*" ) . join . to_i != junk_ar_join . length / 2 restart = true end jmp_junk = "eb" + junk_dis + junk_ar_join else if [ junk_dis ] . pack ( "H*" ) . unpack ( "V*" ) . join . to_i != junk_ar_len or junk_ar_len != junk_count or [ junk_dis ] . pack ( "H*" ) . unpack ( "V*" ) . join . to_i != junk_count or [ junk_dis ] . pack ( "H*" ) . unpack ( "V*" ) . join . to_i != junk_ar_join . length / 2 or junk_dis . scan ( / .. / ) . reverse . join . to_i ( 16 ) != [ junk_dis ] . pack ( "H*" ) . unpack ( "V*" ) . join . to_i or junk_dis . scan ( / .. / ) . reverse . join . to_i ( 16 ) != junk_ar_len or junk_dis . scan ( / .. / ) . reverse . join . to_i ( 16 ) != junk_ar_join . length / 2 restart = true end jmp_junk = "e9" + junk_dis + junk_ar_join end if restart == true or ( ( junk_dis . scan ( / .. / ) ) + $badchars ) . uniq . length != ( ( junk_dis . scan ( / .. / ) ) . uniq ) . length + $badchars . uniq . length count = 0 junk_ar , junk_count , junk_ar_join , junk_ar_len , junk_dis = grab_random_bytes ( ) else count += 1 end end return [ jmp_junk ] . pack ( "H*" ) end
get lambda here to grab our automatic regs
get lambda here to grab our automatic regs
# higher count means higher accuracy but longer loading time #while junk_count > 70 and junk_count < 135 # dead zone #	junk_count = $r.rand(($sm*$mult).to_i..$sm) #end # times 2 becuse here you are 2x as likely to fail. ## yes, this re-enforcement is necessary, ruby isn't always reliable ## yes, this re-enforcement is necessary, ruby isn't always reliable