<commit_before>require 'fileutils'

class Tools
	@projects
	@project
	@apk_path

	def initialize
		@projects = "projects/"
		@project = nil

	end

	def validOptions
		invalids = 0

		invalids += 1 if @project == nil

		return true if invalids == 0
		return false
	end

	def setProjectName(name)
		@project = name
	end

	def createFolders
		return if not validOptions
		[
			"/apk",
			"/java",
			"/jar",
			"/reversed",
			"/unzip",
			"/java/original",
			"/java/cracked",
			"/reversed/original",
			"/reversed/cracked",
			"/unzip/original",
			"/unzip/cracked"
		].each do |subfolder|
			FileUtils::mkdir_p(@projects+@project+subfolder)
		end
	end

	def unzip(original)
		return if not validOptions

		version = "cracked"
		version = "original" if original

		cmd = eval("`unzip #{@projects+@project}/apk/#{version}.apk"} -d #{@projects+@project}/unzip/#{version}"}`")

	end

	def dex2jar(original)
		return if not validOptions

		version = "cracked"
		version = "original" if original
		cmd = eval("`dex2jar/d2j-dex2jar.sh -ts #{@projects+@project}/unzip/#{version}/classes.dex -o #{@projects+@project}/jar/#{version}.jar`")

	end

	def jd-core-java(original)



	end

	def apktool_build(original)

		cmd = eval("`java -jar apktool.jar b -f #{@projects+@project}/reversed/cracked/ -o #{@projects+@project}/apk/cracked.apk`")

	end

	def apktool_decompile(original)

		cmd = eval("`java -jar apktool.jar d -f #{@projects+@project}/apk/original.apk -o #{@projects+@project}/reversed/original`")
		FileUtils::cp_r("#{@projects+@project}/reversed/original", "#{@projects+@project}/reversed/cracked")

	end<commit_msg>Added jd-core-java support<commit_after>require 'fileutils'

class Tools
	@projects
	@project
	@apk_path

	def initialize
		@projects = "projects/"
		@project = nil

	end

	def validOptions
		invalids = 0

		invalids += 1 if @project == nil

		return true if invalids == 0
		return false
	end

	def setProjectName(name)
		@project = name
	end

	def createFolders
		return if not validOptions
		[
			"/apk",
			"/java",
			"/jar",
			"/reversed",
			"/unzip",
			"/java/original",
			"/java/cracked",
			"/reversed/original",
			"/reversed/cracked",
			"/unzip/original",
			"/unzip/cracked"
		].each do |subfolder|
			FileUtils::mkdir_p(@projects+@project+subfolder)
		end
	end

	def unzip(original)
		return if not validOptions

		version = "cracked"
		version = "original" if original

		cmd = eval("`unzip #{@projects+@project}/apk/#{version}.apk"} -d #{@projects+@project}/unzip/#{version}"}`")

	end

	def dex2jar(original)
		return if not validOptions

		version = "cracked"
		version = "original" if original
		cmd = eval("`dex2jar/d2j-dex2jar.sh -ts #{@projects+@project}/unzip/#{version}/classes.dex -o #{@projects+@project}/jar/#{version}.jar`")

	end

	def jd-core-java(original)
		return if not validOptions

		version = "cracked"
		version = "original" if original

		cmd = eval("`java -jar jd-core-java.jar #{@projects+@project}/jar/#{version}.jar #{@projects+@project}/java/#{version}`")

	end

	def apktool_build(original)

		cmd = eval("`java -jar apktool.jar b -f #{@projects+@project}/reversed/cracked/ -o #{@projects+@project}/apk/cracked.apk`")

	end

	def apktool_decompile(original)

		cmd = eval("`java -jar apktool.jar d -f #{@projects+@project}/apk/original.apk -o #{@projects+@project}/reversed/original`")
		FileUtils::cp_r("#{@projects+@project}/reversed/original", "#{@projects+@project}/reversed/cracked")

	end
{'fraction_non_alphanumeric': 0.16642588847154002, 'fraction_numerical': 0.004045073678127709, 'mean_word_length': 3.9670014347202294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1282087', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1224, 'n_words': 267}