Compare commits

...

4 Commits
v0.4 ... v0.4.1

6 changed files with 21 additions and 10 deletions

View File

@@ -40,7 +40,7 @@
#define ACS_SERVER "http://adeactivate.adobe.com/adept" #define ACS_SERVER "http://adeactivate.adobe.com/adept"
#endif #endif
#define LIBGOUROU_VERSION "0.4" #define LIBGOUROU_VERSION "0.4.1"
namespace gourou namespace gourou
{ {

View File

@@ -68,6 +68,7 @@ namespace gourou
enum DOWNLOAD_ERROR { enum DOWNLOAD_ERROR {
DW_NO_ITEM = 0x1200, DW_NO_ITEM = 0x1200,
DW_NO_EBX_HANDLER,
}; };
enum SIGNIN_ERROR { enum SIGNIN_ERROR {
@@ -293,7 +294,7 @@ namespace gourou
*/ */
static inline void writeFile(std::string path, ByteArray& data) static inline void writeFile(std::string path, ByteArray& data)
{ {
writeFile(path, data.data(), data.length()-1); writeFile(path, data.data(), data.length());
} }
/** /**

View File

@@ -37,14 +37,14 @@ namespace gourou
ByteArray::ByteArray(const char* data, int length) ByteArray::ByteArray(const char* data, int length)
{ {
if (length == -1) if (length == -1)
length = strlen(data) + 1; length = strlen(data);
initData((const unsigned char*)data, (unsigned int) length); initData((const unsigned char*)data, (unsigned int) length);
} }
ByteArray::ByteArray(const std::string& str) ByteArray::ByteArray(const std::string& str)
{ {
initData((unsigned char*)str.c_str(), (unsigned int)str.length() + 1); initData((unsigned char*)str.c_str(), (unsigned int)str.length());
} }
void ByteArray::initData(const unsigned char* data, unsigned int length) void ByteArray::initData(const unsigned char* data, unsigned int length)

View File

@@ -611,7 +611,8 @@ namespace gourou
else if (res == PDF) else if (res == PDF)
{ {
uPDFParser::Parser parser; uPDFParser::Parser parser;
bool EBXHandlerFound = false;
try try
{ {
GOUROU_LOG(DEBUG, "Parse PDF"); GOUROU_LOG(DEBUG, "Parse PDF");
@@ -631,6 +632,7 @@ namespace gourou
// Update EBX_HANDLER with rights // Update EBX_HANDLER with rights
if ((*it)->hasKey("Filter") && (**it)["Filter"]->str() == "/EBX_HANDLER") if ((*it)->hasKey("Filter") && (**it)["Filter"]->str() == "/EBX_HANDLER")
{ {
EBXHandlerFound = true;
uPDFParser::Object* ebx = (*it)->clone(); uPDFParser::Object* ebx = (*it)->clone();
(*ebx)["ADEPT_ID"] = new uPDFParser::String(item->getResource()); (*ebx)["ADEPT_ID"] = new uPDFParser::String(item->getResource());
(*ebx)["EBX_BOOKID"] = new uPDFParser::String(item->getResource()); (*ebx)["EBX_BOOKID"] = new uPDFParser::String(item->getResource());
@@ -642,7 +644,12 @@ namespace gourou
} }
} }
parser.write(path, true); if (EBXHandlerFound)
parser.write(path, true);
else
{
EXCEPTION(DW_NO_EBX_HANDLER, "EBX_HANDLER not found");
}
} }
return res; return res;
@@ -907,7 +914,7 @@ namespace gourou
ByteArray privateLicenseKey = ByteArray::fromBase64(user->getPrivateLicenseKey()); ByteArray privateLicenseKey = ByteArray::fromBase64(user->getPrivateLicenseKey());
/* In adobekey.py, we get base64 decoded data [26:] */ /* In adobekey.py, we get base64 decoded data [26:] */
write(fd, privateLicenseKey.data()+26, privateLicenseKey.length()-1-26); write(fd, privateLicenseKey.data()+26, privateLicenseKey.length()-26);
close(fd); close(fd);
} }

View File

@@ -2,10 +2,11 @@
TARGETS=acsmdownloader adept_activate TARGETS=acsmdownloader adept_activate
CXXFLAGS=-Wall `pkg-config --cflags Qt5Core Qt5Network` -fPIC -I$(ROOT)/include -I$(ROOT)/lib/pugixml/src/ CXXFLAGS=-Wall `pkg-config --cflags Qt5Core Qt5Network` -fPIC -I$(ROOT)/include -I$(ROOT)/lib/pugixml/src/
LDFLAGS=`pkg-config --libs Qt5Core Qt5Network` -L$(ROOT) -lcrypto -lzip -lz
ifneq ($(STATIC_UTILS),) ifneq ($(STATIC_UTILS),)
LDFLAGS=`pkg-config --libs Qt5Core Qt5Network` -L$(ROOT) $(ROOT)/libgourou.a -lcrypto -lzip LDFLAGS += $(ROOT)/libgourou.a
else else
LDFLAGS=`pkg-config --libs Qt5Core Qt5Network` -L$(ROOT) -lgourou -lcrypto -lzip -lz LDFLAGS += -lgourou
endif endif
ifneq ($(DEBUG),) ifneq ($(DEBUG),)

View File

@@ -79,6 +79,8 @@ public:
std::string filename; std::string filename;
if (!outputFile) if (!outputFile)
filename = std::string("Adobe_PrivateLicenseKey--") + user->getUsername() + ".der"; filename = std::string("Adobe_PrivateLicenseKey--") + user->getUsername() + ".der";
else
filename = outputFile;
if (outputDir) if (outputDir)
{ {
@@ -173,7 +175,7 @@ static void usage(const char* cmd)
{ {
std::cout << "Download EPUB file from ACSM request file" << std::endl; std::cout << "Download EPUB file from ACSM request file" << std::endl;
std::cout << "Usage: " << cmd << " [(-d|--device-file) device.xml] [(-a|--activation-file) activation.xml] [(-s|--device-key-file) devicesalt] [(-O|--output-dir) dir] [(-o|--output-file) output(.epub|.pdf|.der)] [(-v|--verbose)] [(-h|--help)] (-f|--acsm-file) file.acsm|(-e|--export-private-key)" << std::endl << std::endl; std::cout << "Usage: " << cmd << " [(-d|--device-file) device.xml] [(-a|--activation-file) activation.xml] [(-k|--device-key-file) devicesalt] [(-O|--output-dir) dir] [(-o|--output-file) output(.epub|.pdf|.der)] [(-v|--verbose)] [(-h|--help)] (-f|--acsm-file) file.acsm|(-e|--export-private-key)" << std::endl << std::endl;
std::cout << " " << "-d|--device-file" << "\t" << "device.xml file from eReader" << std::endl; std::cout << " " << "-d|--device-file" << "\t" << "device.xml file from eReader" << std::endl;
std::cout << " " << "-a|--activation-file" << "\t" << "activation.xml file from eReader" << std::endl; std::cout << " " << "-a|--activation-file" << "\t" << "activation.xml file from eReader" << std::endl;