def has_potential_command_injection(user_input):
 s = shlex.shlex(user_input)
 token = s.get_token()
 while (token != ''):
  if (token in [';', '|', '||', '&', '&&', '>', '>>', '<', '<<', '^', '$', '`', '(', '{']):
   print 'Detected potential command injection'
   return True
  token = s.get_token()
 return False

def has_potential_command_injection ( user_input ) : s = shlex . shlex ( user_input ) token = s . get_token ( ) while ( token != '' ) : if ( token in [ ';' , '|' , '||' , '&' , '&&' , '>' , '>>' , '<' , '<<' , '^' , '$' , '`' , '(' , '{' ] ) : print 'Detected potential command injection' return True token = s . get_token ( ) return False
in order to detect potential command injection methods .