MCPcopy Index your code
hub / github.com/cSploit/android / user

Method user

cSploit/src/org/csploit/android/core/ExecChecker.java:139–167  ·  view source on GitHub ↗

check if the cSploit user can create executable files inside a directory. @param dir directory to check @return true if can execute files into dir, false otherwise

(String dir)

Source from the content-addressed store, hash-verified

137 * @return true if can execute files into {@code dir}, false otherwise
138 */
139 private boolean user(String dir) {
140 String tmpname;
141 File tmpfile = null;
142
143 if(dir==null)
144 return false;
145
146 tmpfile = new File(dir);
147
148 try {
149 if(!tmpfile.exists())
150 tmpfile.mkdirs();
151
152 do {
153 tmpname = UUID.randomUUID().toString();
154 } while((tmpfile = new File(dir, tmpname)).exists());
155
156 tmpfile.createNewFile();
157
158 return (tmpfile.canExecute() || tmpfile.setExecutable(true, false));
159
160 } catch (IOException e) {
161 Logger.warning(String.format("cannot create files over '%s'",dir));
162 } finally {
163 if(tmpfile!=null && tmpfile.exists())
164 tmpfile.delete();
165 }
166 return false;
167 }
168
169 /**
170 * check if we can execute binaries in {@code dir}

Callers 2

remountMethod · 0.95
canExecuteInDirMethod · 0.95

Calls 3

warningMethod · 0.95
formatMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected