Cody

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

Solution 3002017

Submitted on 28 Sep 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))

/bin/rm: cannot remove '@*': No such file or directory ans = 0 ans = 0 ans = 42 /bin/rm: cannot remove '@*': No such file or directory [Warning: Name is nonexistent or not a directory: /MATLAB/toolbox/matlab/iot/visualization/thingspeakvisualizations] [> In path (line 34) In ScoringEngineTestPoint1 (line 34) In solutionTest (line 3)]

Assertion failed.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!