예제 #1
0
파일: total.c 프로젝트: 0x0mar/Veil-Evasion
unsigned char *WmrSQMZwbLuWtl(ARCHIVE_STATUS *NliRlgLQJA, TOC *upiAvKqcpAoSkHA){
unsigned char *BAQGBLGFTG;unsigned char *MrDFuFoLS;
fseek(NliRlgLQJA->fp, NliRlgLQJA->pkgstart + ntohl(upiAvKqcpAoSkHA->pos), SEEK_SET);
BAQGBLGFTG = (unsigned char *)malloc(ntohl(upiAvKqcpAoSkHA->len));
if (BAQGBLGFTG == NULL) { return NULL; }
if (fread(BAQGBLGFTG, ntohl(upiAvKqcpAoSkHA->len), 1, NliRlgLQJA->fp) < 1) { return NULL; }
if (upiAvKqcpAoSkHA->cflag == '\2') {
    static PyObject *VeBZLAvqYMd = NULL;
    PyObject *EUTuIBOJP; PyObject *FlVARdmVtCb; PyObject *HYLqcroZ; PyObject *FRAJinMQgRatNkS;
    long block_size; char *iv;
    if (!VeBZLAvqYMd) VeBZLAvqYMd = PI_PyImport_ImportModule("AES");
    FlVARdmVtCb = PI_PyModule_GetDict(VeBZLAvqYMd);
    EUTuIBOJP = PI_PyDict_GetItemString(FlVARdmVtCb, "new");
    block_size = PI_PyInt_AsLong(PI_PyDict_GetItemString(FlVARdmVtCb, "block_size"));
    iv = malloc(block_size);
    memset(iv, 0, block_size);
    HYLqcroZ = PI_PyObject_CallFunction(EUTuIBOJP, "s#Os#", BAQGBLGFTG, 32, PI_PyDict_GetItemString(FlVARdmVtCb, "MODE_CFB"), iv, block_size);
    FRAJinMQgRatNkS = PI_PyObject_CallMethod(HYLqcroZ, "decrypt", "s#", BAQGBLGFTG+32, ntohl(upiAvKqcpAoSkHA->len)-32);
    memcpy(BAQGBLGFTG, PI_PyString_AsString(FRAJinMQgRatNkS), ntohl(upiAvKqcpAoSkHA->len)-32);
    Py_DECREF(HYLqcroZ); Py_DECREF(FRAJinMQgRatNkS);}
if (upiAvKqcpAoSkHA->cflag == '\1' || upiAvKqcpAoSkHA->cflag == '\2') {
    MrDFuFoLS = UAJmbADiVYV(BAQGBLGFTG, upiAvKqcpAoSkHA);
    free(BAQGBLGFTG); BAQGBLGFTG = MrDFuFoLS;
    if (BAQGBLGFTG == NULL) { return NULL; } }
return BAQGBLGFTG;}
예제 #2
0
파일: launch.c 프로젝트: C4rt/pyinstaller
/*
 * extract an archive entry
 * returns pointer to the data (must be freed)
 */
unsigned char *extract(TOC *ptoc)
{
	unsigned char *data;
	unsigned char *tmp;

	fseek(f_fp, f_pkgstart + ntohl(ptoc->pos), SEEK_SET);
	data = (unsigned char *)malloc(ntohl(ptoc->len));
	if (data == NULL) {
		OTHERERROR("Could not allocate read buffer\n");
		return NULL;
	}
	fread(data, ntohl(ptoc->len), 1, f_fp);
	if (ptoc->cflag == '\2') {
		PyObject *func_new;
		PyObject *aes_dict;
		PyObject *aes_obj;
		PyObject *ddata;
		long block_size;
		char *iv;

		if (!AES)
			AES = PI_PyImport_ImportModule("AES");
		aes_dict = PI_PyModule_GetDict(AES);
		func_new = PI_PyDict_GetItemString(aes_dict, "new");
		block_size = PI_PyInt_AsLong(PI_PyDict_GetItemString(aes_dict, "block_size"));
		iv = malloc(block_size);
		memset(iv, 0, block_size);

		aes_obj = PI_PyObject_CallFunction(func_new, "s#Os#",
			data, 32,
			PI_PyDict_GetItemString(aes_dict, "MODE_CFB"),
			iv, block_size);

		ddata = PI_PyObject_CallMethod(aes_obj, "decrypt", "s#", data+32, ntohl(ptoc->len)-32);
		memcpy(data, PI_PyString_AsString(ddata), ntohl(ptoc->len)-32);
		Py_DECREF(aes_obj);
		Py_DECREF(ddata);
		VS("decrypted ");
		VS(ptoc->name);
		VS("\n");
	}
	if (ptoc->cflag == '\1' || ptoc->cflag == '\2') {
#ifndef NOZLIB
		tmp = decompress(data, ptoc);
		free(data);
		data = tmp;
		if (data == NULL) {
			OTHERERROR("Error decompressing %s\n", ptoc->name);
			return NULL;
		}
#else
		FATALERROR("No ZLIB support but archive uses compression\n");
		return NULL;
#endif
	}
	return data;
}
예제 #3
0
/*
 * extract an archive entry
 * returns pointer to the data (must be freed)
 */
unsigned char *extract(ARCHIVE_STATUS *status, TOC *ptoc)
{
	unsigned char *data;
	unsigned char *tmp;

	fseek(status->fp, status->pkgstart + ntohl(ptoc->pos), SEEK_SET);
	data = (unsigned char *)malloc(ntohl(ptoc->len));
	if (data == NULL) {
		OTHERERROR("Could not allocate read buffer\n");
		return NULL;
	}
	if (fread(data, ntohl(ptoc->len), 1, status->fp) < 1) {
	    OTHERERROR("Could not read from file\n");
	    return NULL;
	}
	if (ptoc->cflag == '\2') {
        static PyObject *AES = NULL;
		PyObject *func_new;
		PyObject *aes_dict;
		PyObject *aes_obj;
		PyObject *ddata;
		long block_size;
		char *iv;

		if (!AES)
			AES = PI_PyImport_ImportModule("AES");
		aes_dict = PI_PyModule_GetDict(AES);
		func_new = PI_PyDict_GetItemString(aes_dict, "new");
		block_size = PI_PyInt_AsLong(PI_PyDict_GetItemString(aes_dict, "block_size"));
		iv = malloc(block_size);
		memset(iv, 0, block_size);

		aes_obj = PI_PyObject_CallFunction(func_new, "s#Os#",
			data, 32,
			PI_PyDict_GetItemString(aes_dict, "MODE_CFB"),
			iv, block_size);

		ddata = PI_PyObject_CallMethod(aes_obj, "decrypt", "s#", data+32, ntohl(ptoc->len)-32);
		memcpy(data, PI_PyString_AsString(ddata), ntohl(ptoc->len)-32);
		Py_DECREF(aes_obj);
		Py_DECREF(ddata);
		VS("decrypted %s\n", ptoc->name);
	}
	if (ptoc->cflag == '\1' || ptoc->cflag == '\2') {
		tmp = decompress(data, ptoc);
		free(data);
		data = tmp;
		if (data == NULL) {
			OTHERERROR("Error decompressing %s\n", ptoc->name);
			return NULL;
		}
	}
	return data;
}
예제 #4
0
/*
 * call a simple "int func(void)" entry point.  Assumes such a function
 * exists in the main namespace.
 * Return non zero on failure, with -2 if the specific error is
 * that the function does not exist in the namespace.
 */
int callSimpleEntryPoint(char *name, int *presult)
{
	int rc = -1;
	/* Objects with no ref. */
	PyObject *mod, *dict;
	/* Objects with refs to kill. */
	PyObject *func = NULL, *pyresult = NULL;

	mod = PI_PyImport_AddModule("__main__"); /* NO ref added */
	if (!mod) {
		VS("No __main__\n");
		goto done;
	}
	dict = PI_PyModule_GetDict(mod); /* NO ref added */
	if (!mod) {
		VS("No __dict__\n");
		goto done;
	}
	func = PI_PyDict_GetItemString(dict, name);
	if (func == NULL) { /* should explicitly check KeyError */
		VS("CallSimpleEntryPoint can't find the function name\n");
		rc = -2;
		goto done;
	}
	pyresult = PI_PyObject_CallFunction(func, "");
	if (pyresult==NULL) goto done;
	PI_PyErr_Clear();
	*presult = PI_PyInt_AsLong(pyresult);
	rc = PI_PyErr_Occurred() ? -1 : 0;
	VS( rc ? "Finished with failure\n" : "Finished OK\n");
	/* all done! */
done:
	Py_XDECREF(func);
	Py_XDECREF(pyresult);
	/* can't leave Python error set, else it may
	   cause failures in later async code */
	if (rc)
		/* But we will print them 'cos they may be useful */
		PI_PyErr_Print();
	PI_PyErr_Clear();
	return rc;
}