Cody

Problem 1747. Get me! v3

Solution 2850011

Submitted on 19 Aug 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 !cp get_me.m safe !rm *.* !mv safe get_me.m !rm @* % Clean user's function from some known jailbreaking mechanisms fid = fopen('get_me.m'); st = regexprep(char(fread(fid)'), '!', 'error(''No shell commands!''); %'); st = regexprep(st, 'feval', 'error(''No fancy functions!''); %'); st = regexprep(st, 'str2func', 'error(''No fancy functions!''); %'); st = regexprep(st, 'regex', 'error(''No fancy functions!''); %'); st = regexprep(st, 'system', 'error(''No shell commands!''); %'); st = regexprep(st, 'dos', 'error(''No shell commands!''); %'); st = regexprep(st, 'unix', 'error(''No shell commands!''); %'); st = regexprep(st, 'perl', 'error(''No external languages commands!''); %'); st = regexprep(st, 'java', 'error(''No external languages commands!''); %'); fclose(fid) fid = fopen('get_me.m' , 'w'); fwrite(fid,st); fclose(fid) % Release the Kraken! get_me() % Try to cleanup the mess !cp get_me.m safe !rm *.* !mv safe get_me.m !rm @* path(pathdef) % undo any change on search path assert(isequal(ans,now))

cp: cannot stat 'get_me.m': No such file or directory mv: cannot stat 'safe': No such file or directory rm: cannot remove '@*': No such file or directory

Error using fread Invalid file identifier. Use fopen to generate a valid file identifier. Error in Test1 (line 10)

Suggested Problems

More from this Author6

Community Treasure Hunt

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

Start Hunting!