Libgourou

Libgourou Commit Details

Date:2023-01-05 21:29:55 (5 months 3 days ago)
Author:Grégory Soutadé
Branch:master, turco
Commit:ab5afa50038e987da7d92794564df45382b3d1a0
Parents: 937c27fc2373cd5649d69f72993ffeb342f5ef32
Message:Add new default ADEPT directories : /home/<user>/.config/adept and $ADEPT_DIR environment variable

Changes:
MREADME.md (1 diff)
Minclude/libgourou.h (3 diffs)
Msrc/libgourou.cpp (3 diffs)
Mutils/acsmdownloader.cpp (1 diff)
Mutils/adept_activate.cpp (1 diff)
Mutils/adept_loan_mgt.cpp (1 diff)
Mutils/adept_remove.cpp (1 diff)
Mutils/utils_common.cpp (2 diffs)

File differences

README.md
8282
8383
8484
85
85
8686
8787
88
89
90
91
92
93
94
95
96
8897
8998
90
99
91100
92101
93102
94
95103
96104
97105
98106
99
100107
101108
102109
103110
104
105111
106112
107113
108114
109
110115
111116
112117
113118
114
115119
116120
121
117122
118123
119124
Utils
-----
You can import configuration from your eReader or create a new one with _utils/adept\_activate_ :
First, add libgourou.so to your LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
You can optionaly specify your .adept directory
export ADEPT_DIR=/home/XXX
Then, use utils as following :
You can import configuration from your eReader or create a new one with _utils/adept\_activate_ :
./utils/adept_activate -u <AdobeID USERNAME>
Then a _./.adept_ directory is created with all configuration file
Then a _/home/<user>/.config/adept_ directory is created with all configuration file
To download an ePub/PDF :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/acsmdownloader -f <ACSM_FILE>
To export your private key (for DeDRM software) :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/acsmdownloader --export-private-key [-o adobekey_1.der]
To remove ADEPT DRM :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/adept_remove -f <encryptedFile>
To list loaned books :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/adept_loan_mgt [-l]
To return a loaned book :
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
./utils/adept_loan_mgt -r <id>
You can get utils full options description with -h or --help switch
include/libgourou.h
3232
3333
3434
35
36
37
38
3935
4036
4137
......
107103
108104
109105
106
107
108
109
110
110111
111112
112113
......
118119
119120
120121
121
122
122123
123124
124125
#define HOBBES_DEFAULT_VERSION "10.0.4"
#endif
#ifndef DEFAULT_ADEPT_DIR
#define DEFAULT_ADEPT_DIR "./.adept"
#endif
#ifndef ACS_SERVER
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
#endif
* @param operatorURL URL of operator that loans this book
*/
void returnLoan(const std::string& loanID, const std::string& operatorURL);
/**
* @brief Return default ADEPT directory (ie /home/<user>/.config/adept)
*/
static std::string getDefaultAdeptDir(void);
/**
* @brief Create a new ADEPT environment (device.xml, devicesalt and activation.xml).
* @param ACSServer Override main ACS server (default adeactivate.adobe.com)
*/
static DRMProcessor* createDRMProcessor(DRMProcessorClient* client,
bool randomSerial=false, const std::string& dirName=std::string(DEFAULT_ADEPT_DIR),
bool randomSerial=false, std::string dirName=std::string(""),
const std::string& hobbes=std::string(HOBBES_DEFAULT_VERSION),
const std::string& ACSServer=ACS_SERVER);
src/libgourou.cpp
2828
2929
3030
31
32
3133
3234
3335
......
6870
6971
7072
71
73
7274
7375
7476
7577
78
79
80
7681
7782
7883
......
844849
845850
846851
847
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
848869
849870
850871
#include <libgourou_common.h>
#include <libgourou_log.h>
#define LOCAL_ADEPT_DIR "./.adept"
#define ASN_NONE 0x00
#define ASN_NS_TAG 0x01
#define ASN_CHILD 0x02
if (user) delete user;
}
DRMProcessor* DRMProcessor::createDRMProcessor(DRMProcessorClient* client, bool randomSerial, const std::string& dirName,
DRMProcessor* DRMProcessor::createDRMProcessor(DRMProcessorClient* client, bool randomSerial, std::string dirName,
const std::string& hobbes, const std::string& ACSServer)
{
DRMProcessor* processor = new DRMProcessor(client);
if (dirName == "")
dirName = getDefaultAdeptDir();
Device* device = Device::createDevice(processor, dirName, hobbes, randomSerial);
processor->device = device;
addNonce(root);
signNode(root);
}
std::string DRMProcessor::getDefaultAdeptDir(void)
{
#ifndef DEFAULT_ADEPT_DIR
const char* user = getenv("USER");
if (user && user[0])
{
return std::string("/home/") + user + std::string("/.config/adept/");
}
else
return LOCAL_ADEPT_DIR;
#else
return DEFAULT_ADEPT_DIR "/";
#endif
}
void DRMProcessor::returnLoan(const std::string& loanID, const std::string& operatorURL)
{
pugi::xml_document returnReq;
utils/acsmdownloader.cpp
201201
202202
203203
204
205
204206
205207
206208
std::cout << std::endl;
std::cout << "Device file, activation file and device key file are optionals. If not set, they are looked into :" << std::endl;
std::cout << " * $ADEPT_DIR environment variable" << std::endl;
std::cout << " * /home/<user>/.config/adept" << std::endl;
std::cout << " * Current directory" << std::endl;
std::cout << " * .adept" << std::endl;
std::cout << " * adobe-digital-editions directory" << std::endl;
utils/adept_activate.cpp
230230
231231
232232
233
233
234234
235235
236236
if (!_outputDir || _outputDir[0] == 0)
{
outputDir = strdup(abspath(DEFAULT_ADEPT_DIR));
outputDir = strdup(abspath(gourou::DRMProcessor::getDefaultAdeptDir().c_str()));
}
else
{
utils/adept_loan_mgt.cpp
348348
349349
350350
351
352
351353
352354
353355
std::cout << std::endl;
std::cout << "ADEPT directory is optional. If not set, it's looked into :" << std::endl;
std::cout << " * $ADEPT_DIR environment variable" << std::endl;
std::cout << " * /home/<user>/.config/adept" << std::endl;
std::cout << " * Current directory" << std::endl;
std::cout << " * .adept" << std::endl;
std::cout << " * adobe-digital-editions directory" << std::endl;
utils/adept_remove.cpp
158158
159159
160160
161
162
161163
162164
163165
std::cout << std::endl;
std::cout << "Device file, activation file and device key file are optionals. If not set, they are looked into :" << std::endl;
std::cout << " * $ADEPT_DIR environment variable" << std::endl;
std::cout << " * /home/<user>/.config/adept" << std::endl;
std::cout << " * Current directory" << std::endl;
std::cout << " * .adept" << std::endl;
std::cout << " * adobe-digital-editions directory" << std::endl;
utils/utils_common.cpp
6161
6262
6363
64
65
66
67
68
69
70
71
72
73
74
75
76
77
6478
6579
6680
......
6882
6983
7084
71
85
7286
7387
7488
const char* findFile(const char* filename, bool inDefaultDirs)
{
std::string path;
const char* adeptDir = getenv("ADEPT_DIR");
if (adeptDir && adeptDir[0])
{
path = adeptDir + std::string("/") + filename;
if (fileExists(path.c_str()))
return strdup(path.c_str());
}
path = gourou::DRMProcessor::getDefaultAdeptDir() + filename;
if (fileExists(path.c_str()))
return strdup(path.c_str());
if (fileExists(filename))
return strdup(filename);
for (int i=0; i<(int)ARRAY_SIZE(defaultDirs); i++)
{
std::string path = std::string(defaultDirs[i]) + filename;
path = std::string(defaultDirs[i]) + filename;
if (fileExists(path.c_str()))
return strdup(path.c_str());
}

Archive Download the corresponding diff file