Cody

Problem 1752. Get me! v4 (Cody hacking challenge)

Solution 2299894

Submitted on 19 May 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
% Clean workspace !/bin/cp get_me.m safe !/bin/rm *.* !/bin/mv safe get_me.m !/bin/rm @* % Clean user's function from some known jailbreaking mechanisms functions = {'!','feval','str2func','regex','system','dos','unix','perl','java','fopen','write','save','setenv','path'}; fid = fopen('get_me.m'); st = char(fread(fid)'); for n = 1:numel(functions) st = regexprep(st, functions{n}, 'error(''No fancy functions!''); %', 'ignorecase'); end fclose(fid) % Force a function header, and comment first code's line (the supposedly users' function header) st = sprintf('function y = get_me()\n%%%s', st); fid = fopen('get_me.m' , 'w'); fwrite(fid,st); fclose(fid) % Release the Kraken! get_me() % Try to cleanup the mess !/bin/cp get_me.m safe !/bin/rm *.* !/bin/mv safe get_me.m !/bin/rm @* path(pathdef) % undo any change on search path assert(isequal(ans,now))

Error in solution: Line: 1 Column: 1 Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.

Suggested Problems

More from this Author6