Пример #1
0
        else:
            ret['status'] = 'error'
            ret['error_msg'] = user_trace_final_entry['exception_msg']

    # Crucial first line to make sure that Apache serves this data
    # correctly - DON'T FORGET THE EXTRA NEWLINES!!!:
    print "Content-type: text/plain; charset=iso-8859-1\n\n"
    output_json = demjson.encode(ret, compactly=True)
    print output_json


form = cgi.FieldStorage()
user_script = form['user_script'].value
expect_script = form['expect_script'].value

# WEIRD: always run the expect_script FIRST since it's less likely to have
# errors.  for some mysterious reason, if there's an error in user_script,
# then it will never run expect_script
#
# also make sure to ignore IDs so that we can do direct object comparisons!
pg_logger.exec_script_str(expect_script,
                          expect_script_finalizer,
                          ignore_id=True)

# set a custom instruction limit only for user scripts ...
if 'max_instructions' in form:
    pg_logger.set_max_executed_lines(int(form['max_instructions'].value))

pg_logger.exec_script_str(user_script, user_script_finalizer, ignore_id=True)
Пример #2
0
    else:
      ret['status'] = 'error'
      ret['error_msg'] = user_trace_final_entry['exception_msg']


  # Crucial first line to make sure that Apache serves this data
  # correctly - DON'T FORGET THE EXTRA NEWLINES!!!:
  print "Content-type: text/plain; charset=iso-8859-1\n\n"
  output_json = demjson.encode(ret, compactly=True)
  print output_json


form = cgi.FieldStorage()
user_script = form['user_script'].value
expect_script = form['expect_script'].value

# WEIRD: always run the expect_script FIRST since it's less likely to have
# errors.  for some mysterious reason, if there's an error in user_script,
# then it will never run expect_script
#
# also make sure to ignore IDs so that we can do direct object comparisons!
pg_logger.exec_script_str(expect_script, expect_script_finalizer, ignore_id=True)


# set a custom instruction limit only for user scripts ...
if 'max_instructions' in form:
  pg_logger.set_max_executed_lines(int(form['max_instructions'].value))

pg_logger.exec_script_str(user_script, user_script_finalizer, ignore_id=True)
Пример #3
0
                    had_error = True

            (con, cur) = db_common.db_connect()
            cur.execute(
                "INSERT INTO query_log VALUES (NULL, ?, ?, ?, ?, ?)",
                (
                    int(time.time()),
                    os.environ.get("REMOTE_ADDR", "N/A"),
                    os.environ.get("HTTP_USER_AGENT", "N/A"),
                    user_script,
                    had_error,
                ),
            )
            con.commit()
            cur.close()
        except:
            # haha this is bad form, but silently fail on error :)
            pass

    # Crucial first line to make sure that Apache serves this data
    # correctly - DON'T FORGET THE EXTRA NEWLINES!!!:
    print "Content-type: text/plain; charset=iso-8859-1\n\n"
    print output_json


# form = cgi.FieldStorage()
# user_script = form['user_script'].value
# if 'max_instructions' in form:
pg_logger.set_max_executed_lines(2000000)
pg_logger.exec_script_str(user_script, web_finalizer)