Files
Pyarmor-Static-Unpack-1shot/pycdc.cpp

32 lines
807 B
C++
Raw Normal View History

#include <cstring>
2009-07-26 10:07:13 +00:00
#include "ASTree.h"
#ifdef WIN32
# define PATHSEP '\\'
#else
# define PATHSEP '/'
#endif
2009-07-26 10:07:13 +00:00
int main(int argc, char* argv[])
{
if (argc < 2) {
fputs("No input file specified\n", stderr);
2009-07-26 10:07:13 +00:00
return 1;
}
PycModule mod;
mod.loadFromFile(argv[1]);
if (!mod.isValid()) {
fprintf(stderr, "Could not load file %s\n", argv[1]);
return 1;
}
const char* dispname = strrchr(argv[1], PATHSEP);
dispname = (dispname == NULL) ? argv[1] : dispname + 1;
fputs("# Source Generated with Decompyle++\n", pyc_output);
2011-10-23 19:04:06 -07:00
fprintf(pyc_output, "# File: %s (Python %d.%d%s)\n\n", dispname, mod.majorVer(), mod.minorVer(),
(mod.majorVer() < 3 && mod.isUnicode()) ? " Unicode" : "");
decompyle(mod.code(), &mod);
2009-07-26 10:07:13 +00:00
return 0;
}