Analysers rewrite, mostly by Ramkoemar, partially by myself
This commit is contained in:
parent
b4dc59d409
commit
506be4a64b
24 changed files with 890 additions and 700 deletions
47
src/utils/util_amf.cpp
Normal file
47
src/utils/util_amf.cpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
/// \file util_amf.cpp
|
||||
/// Debugging tool for AMF data.
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <mist/amf.h>
|
||||
#include <mist/config.h>
|
||||
#include <mist/defines.h>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char **argv){
|
||||
Util::Config conf(argv[0]);
|
||||
JSON::Value opt;
|
||||
opt["arg_num"] = 1ll;
|
||||
opt["arg"] = "string";
|
||||
opt["default"] = "-";
|
||||
opt["help"] = "Filename to analyse, or - for standard input (default)";
|
||||
conf.addOption("filename", opt);
|
||||
conf.parseArgs(argc, argv);
|
||||
|
||||
std::string filename = conf.getString("filename");
|
||||
if (filename.size() && filename != "-"){
|
||||
int fp = open(filename.c_str(), O_RDONLY);
|
||||
if (fp <= 0){
|
||||
FAIL_MSG("Cannot open '%s': %s", filename.c_str(), strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
dup2(fp, STDIN_FILENO);
|
||||
close(fp);
|
||||
INFO_MSG("Parsing %s...", filename.c_str());
|
||||
}else{
|
||||
INFO_MSG("Parsing standard input...");
|
||||
}
|
||||
|
||||
std::string amfBuffer;
|
||||
// Read all of std::cin to amfBuffer
|
||||
while (std::cin.good()){amfBuffer += std::cin.get();}
|
||||
// Strip the invalid last character
|
||||
amfBuffer.erase((amfBuffer.end() - 1));
|
||||
// Parse into an AMF::Object
|
||||
AMF::Object amfData = AMF::parse(amfBuffer);
|
||||
// Print the output.
|
||||
std::cout << amfData.Print() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
18
src/utils/util_rax.cpp
Normal file
18
src/utils/util_rax.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <iostream>
|
||||
#include <mist/util.h>
|
||||
#include <mist/shared_memory.h>
|
||||
|
||||
int main(int argc, char ** argv){
|
||||
if (argc < 1){
|
||||
FAIL_MSG("Usage: %s MEMORY_PAGE_NAME");
|
||||
return 1;
|
||||
}
|
||||
IPC::sharedPage f(argv[1], 0, false, false);
|
||||
const Util::RelAccX A(f.mapped, false);
|
||||
if (A.isReady()){
|
||||
std::cout << A.toPrettyString() << std::endl;
|
||||
}else{
|
||||
std::cout << "Memory structure " << argv[1] << " is not ready" << std::endl;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue