程序代写

Regexp

Home WeChat: cstutorcs QQ: 749389476 * Simple regular expression matching. * The Practice of Programming * Brian W. Kernighan, Rob Pike * Modified by: Michael D. Brown * Purpose: This library is a modified version of a KLEE tutorial adapted for academic use. #include static int matchhere(char*,char*); static int matchstar(int c, char *re, char *text) […]

Regexp Read More »

Utility

Home WeChat: cstutorcs QQ: 749389476 * Obfuscated Utility Program Backdoor Lab * Author: Joel Cooper * Modified by: Michael Brown * Purpose: This code is a graded portion of a KLEE Lab for academic use. #include #include #include #include #include char* U = “Usage: ubelt -acghotx \n\ a – list files in current folder: if

Utility Read More »

Printer

Home WeChat: cstutorcs QQ: 749389476 #include “DataflowAnalysis.h” namespace dataflow{ struct Printer: public FunctionPass { static char ID; Printer() : FunctionPass(ID){} protected: * Print information about each instruction in each function. bool runOnFunction(Function &F) override{ errs()

Printer Read More »

ReachDefAnalysis

Home WeChat: cstutorcs QQ: 749389476 #include “DataflowAnalysis.h” namespace dataflow{ struct ReachDefAnalysis: public DataflowAnalysis{ static char ID; ReachDefAnalysis() : DataflowAnalysis(ID){} protected: * Implement your analysis in this function. Store your results in DataflowAnalysis::inMap and * DataflowAnalysis:outMap. void doAnalysis(Function &F) override{ virtual std::string getAnalysisName() override{ return “ReachDef”; char ReachDefAnalysis::ID = 1; static RegisterPass X(“ReachDef”, “Reach Definition Analysis”,

ReachDefAnalysis Read More »

Utils

Home WeChat: cstutorcs QQ: 749389476 #include “Utils.h” #include “llvm/IR/CFG.h” const char *WhiteSpaces = ” \t\n\r”; std::string toString(Value *I) { std::string Str; raw_string_ostream SS(Str); I->print(SS); return SS.str(); std::vector getPredecessors(Instruction *I) { std::vector Ret; BasicBlock *BB = I->getParent(); for (BasicBlock::reverse_iterator It = BB->rbegin(), E = BB->rend(); It != E; if (&(*It) == I) { if (It ==

Utils Read More »

Extractor

Home WeChat: cstutorcs QQ: 749389476 #include “Extractor.h” #include “llvm/IR/Instruction.h” void Extractor::initialize(AnalysisMode Mode) { Solver->register_relation(Kill); Solver->register_relation(Gen); Solver->register_relation(Next); Solver->register_relation(In); Solver->register_relation(Out); /* Variables for Rules * You may reuse X, Y, Z in all your rules expressions further down * You can also define more variables like these if you need * These variables are bitvectors of length

Extractor Read More »

calc

Home WeChat: cstutorcs QQ: 749389476 # include int main() { char operator; int firstNumber,secondNumber; printf(“Enter an operator (+, -, *, /): “); scanf(” %c”, &operator); printf(“Enter two operands: “); scanf(“%d %d”, &firstNumber, &secondNumber); switch (operator) { printf(“%d + %d = %d\n”,firstNumber, secondNumber, firstNumber + secondNumber); printf(“%d – %d = %d\n”,firstNumber, secondNumber, firstNumber – secondNumber); printf(“%d

calc Read More »

Instrument

Home WeChat: cstutorcs QQ: 749389476 #include “Instrument.h” using namespace llvm; namespace instrument { static const char *SanitizerFunctionName = “__dbz_sanitizer__”; static const char *CoverageFunctionName = “__coverage__”; * Implement divide-by-zero sanitizer. void instrumentSanitizer(Module *M, Function &F, Instruction &I) { /* Add your code here */ int divisor = 0; int line = 0; int column = 0;

Instrument Read More »

DataflowAnalysis

Home WeChat: cstutorcs QQ: 749389476 #include “DataflowAnalysis.h” using namespace llvm; namespace dataflow { DataflowAnalysis::DataflowAnalysis(char ID) : FunctionPass(ID){} bool DataflowAnalysis::runOnFunction(Function &F){ errs()

DataflowAnalysis Read More »