<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int unziper()
{	
	char choice1[10];
	char firmware[80];
	char buildCommand[120];

	printf("\n\nDecompress firmware ?\n");
	printf("1) YES\n");
	printf("2) NO\n");
	fget(choice1, 10);

	if (strcmp(choice1, "yes")==0 || strcmp(choice1, "1")==0)
	{
		printf("Firmware to decompress : ");
		fget(firmware, 80);

		printf("Extracting firmware in the IPSW folder...\n");
		sprintf(buildCommand, "7z x -oIPSW %s", firmware); 
		system(buildCommand);
	}
	else if (strcmp(choice1, "no")== 0 || strcmp(choice1, "2")==0 )
	{
		/*Nothing to do*/
	}
	
	return 0;
}

int ipswDownloader()
{
	char model[10];
	char choice1[10];
	char version[7];
	char link[1024];

	printf("Download firmware ?\n");
	printf("1) YES\n");
	printf("2) NO\n");
	fget(choice1, 10);
	if (strcmp(choice1, "yes")==0 || strcmp(choice1, "1")==0)
	{
		printf("Model : ");
		fget(model, 10);
		printf("Version : ");
		fget(version, 7);

		printf("The firmware will be automaticaly extracted\n");

		printf("Downloading IPSW, please wait...\n");
		
		sprintf(link,"wget http://api.ipsw.me/v2/%s/%s/url/dl -O firmware.ipsw",model,version);
		system(link);
		system("7z x -oIPSW firmware.ipsw");
	}
	else if(strcmp(choice1, "no")==0 || strcmp(choice1, "2")==0)
	{
		printf("\n");
	}
	return 0;
}


int rootfs()						/*repack*/
{
	char choice[4];
	char rootfs[80];
	char buildCommand[1024];
	char rootfs_def[1024];
	char key[80];
	char keyiv[80];
	char decrypt[256];
	
	unziper();
	system("clear");
	
	printf("Entrer rootfs name : ");
	fget(rootfs, 80);
	chdir("IPSW");
	
	printf("Enter firmware key : ");
	fget(key, 80);

	sprintf(decrypt, "dmg extract %s rootfs_decrypt.dmg -k %s", rootfs, key); 
	system(decrypt);

	printf("Decrypting finished\n");

	/*You won't be able to make a custom firmware or bypass iCloud, it's not easier than you think*/
	printf("Repack firmware ? \n");
	printf("1) YES\n");
	printf("2) NO\n");
	fget(choice, 4);

	if (strcmp(choice, "yes")==0 || strcmp(choice, "1")==0)
	{
		printf("Building rootfs...\n");
		sprintf(rootfs_def, "%s", rootfs);
		remove(rootfs_def);
		sprintf(buildCommand,"dmg build rootfs_decrypt.dmg %s", rootfs);
		system(buildCommand);

		printf("Repacking IPSW...\n");
		system("7z u -tzip -mx0 custom_firmware.ipsw -x!7z");

		printf("Firmware packed !\n");			
	}
	else if(strcmp(choice, "no")==0 || strcmp(choice, "2")==0)
	{
		printf("\n"); //normal
	}

	return 0;
}

int Ramdisk()
{
	char name[120];
	char buildCommand[1024];
	char key[80];
	char keyiv[80];
	
	unziper();
	system("clear");

	chdir("IPSW");
	printf("Enter the Ramdisk name : ");
	fget(name, 120);

	printf("Enter key for the Ramdisk : ");
	fget(key, 80);

	printf("Enter IV key for the Ramdisk : ");
	fget(keyiv, 80);

	sprintf(buildCommand, "dmg %s %s.dec -k %s -iv %s ", name, name, key, keyiv);
	system(buildCommand);

	printf("%s.dec copied at the folder's root\n", name);

	return 0;
}

int IMG3()
{	
	char name[120];
	char buildCommand[1024];
	char key[80];
	char keyiv[80];
	char boardID[10];
	char command[80];
	char img3_dir[1024];
	unziper();
	system("clear");

	printf("Board ID (e.g n49ap for iPhone5,4) : ");
	fget(boardID, 10);
	<commit_msg>Fixed something :)<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int unziper()
{	
	char choice1[10];
	char firmware[80];
	char buildCommand[120];

	printf("\n\nDecompress firmware ?\n");
	printf("1) YES\n");
	printf("2) NO\n");
	fget(choice1, 10);

	if (strcmp(choice1, "yes")==0 || strcmp(choice1, "1")==0)
	{
		printf("Firmware to decompress : ");
		fget(firmware, 80);

		printf("Extracting firmware in the IPSW folder...\n");
		sprintf(buildCommand, "7z x -oIPSW %s", firmware); 
		system(buildCommand);
	}
	else if (strcmp(choice1, "no")== 0 || strcmp(choice1, "2")==0 )
	{
		/*Nothing to do*/
	}
	
	return 0;
}

int ipswDownloader()
{
	char model[10];
	char choice1[10];
	char version[7];
	char link[1024];

	printf("Download firmware ?\n");
	printf("1) YES\n");
	printf("2) NO\n");
	fget(choice1, 10);
	if (strcmp(choice1, "yes")==0 || strcmp(choice1, "1")==0)
	{
		printf("Model : ");
		fget(model, 10);
		printf("Version : ");
		fget(version, 7);

		printf("The firmware will be automaticaly extracted\n");

		printf("Downloading IPSW, please wait...\n");
		
		sprintf(link,"wget http://api.ipsw.me/v2/%s/%s/url/dl -O firmware.ipsw",model,version);
		system(link);
		system("7z x -oIPSW firmware.ipsw");
	}
	else if(strcmp(choice1, "no")==0 || strcmp(choice1, "2")==0)
	{
		printf("\n");
	}
	return 0;
}


int rootfs()						/*repack*/
{
	char choice[4];
	char rootfs[80];
	char buildCommand[1024];
	char rootfs_def[1024];
	char key[80];
	char keyiv[80];
	char decrypt[256];
	
	unziper();
	system("clear");
	
	printf("Entrer rootfs name : ");
	fget(rootfs, 80);
	chdir("IPSW");
	
	printf("Enter firmware key : ");
	fget(key, 80);

	sprintf(decrypt, "dmg extract %s rootfs_decrypt.dmg -k %s", rootfs, key); 
	system(decrypt);

	printf("Decrypting finished\n");

	/*You won't be able to make a custom firmware or bypass iCloud, it's not easier than you think*/
	printf("Repack firmware ? \n");
	printf("1) YES\n");
	printf("2) NO\n");
	fget(choice, 4);

	if (strcmp(choice, "yes")==0 || strcmp(choice, "1")==0)
	{
		printf("Building rootfs...\n");
		sprintf(rootfs_def, "%s", rootfs);
		remove(rootfs_def);
		sprintf(buildCommand,"dmg build rootfs_decrypt.dmg %s", rootfs);
		system(buildCommand);

		printf("Repacking IPSW...\n");
		system("7z u -tzip -mx0 custom_firmware.ipsw -x!7z");

		printf("Firmware packed !\n");			
	}
	else if(strcmp(choice, "no")==0 || strcmp(choice, "2")==0)
	{
		printf("\n"); //normal
	}

	return 0;
}

int Ramdisk()
{
	char name[120];
	char buildCommand[1024];
	char key[80];
	char keyiv[80];
	
	unziper();
	system("clear");

	chdir("IPSW");
	printf("Enter the Ramdisk name : ");
	fget(name, 120);

	printf("Enter key for the Ramdisk : ");
	fget(key, 80);

	printf("Enter IV key for the Ramdisk : ");
	fget(keyiv, 80);

	sprintf(buildCommand, "xpwntool %s %s.dec -k %s -iv %s ", name, name, key, keyiv);
	system(buildCommand);

	printf("%s.dec copied at the folder's root\n", name);

	return 0;
}

int IMG3()
{	
	char name[120];
	char buildCommand[1024];
	char key[80];
	char keyiv[80];
	char boardID[10];
	char command[80];
	char img3_dir[1024];
	unziper();
	system("clear");

	printf("Board ID (e.g n49ap for iPhone5,4) : ");
	fget(boardID, 10);
	
{'fraction_non_alphanumeric': 0.20130881894671238, 'fraction_numerical': 0.043315674665004675, 'mean_word_length': 4.257166257166257, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1961104', 'n_tokens_mistral': 2875, 'n_tokens_neox': 2570, 'n_words': 608}