-
Notifications
You must be signed in to change notification settings - Fork 28
Command line options
Duy Tai Nguyen edited this page Jun 6, 2019
·
3 revisions
Although, SFuzz depends on solidity compiler to compile smart contracts. We don't want to embed the compiler to our tool. We instead generate scripts called "fuzzMe.sh" and force users to compile solidity files by using their own solidity compiler. Once we have the output which contains abi and bytecode of the target contract and attackers, SFuzz starts running.
Sfuzz searches and compiles solidity files by using functions in fuzzer/Utils.h file:
void forEachFile(string folder, string extension, function<void (directory_entry)> cb) {
path folderPath(folder);
for (auto& file : boost::make_iterator_range(directory_iterator(folderPath), {})) {
if (!is_directory(file.status()) && boost::ends_with(file.path().string(), extension)) cb(file);
}
}
string compileSolFiles(string folder) {
stringstream ret;
forEachFile(folder, ".sol", [&](directory_entry file) {
string filePath = file.path().string();
ret << "solc";
ret << " --combined-json abi,bin,bin-runtime,srcmap,srcmap-runtime " + filePath;
ret << " > " + filePath + ".json";
ret << endl;
});
return ret.str();
}
forEachFile
accepts folder
and extension
as parameters. Whenever a file in the folder
has extension
, the callback will be invoked.
To support the recursive search, You can edit forEachFile
function or create a new one to use in compileSolFiles
.