MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / HTMLForm

Class HTMLForm

thirdparty/clientform/clientform.py:2529–3416  ·  view source on GitHub ↗

Represents a single HTML ... element. A form consists of a sequence of controls that usually have names, and which can take on various values. The values of the various types of controls represent variously: text, zero-or-one-of-many or many-of-many choices, and file

Source from the content-addressed store, hash-verified

2527
2528
2529class HTMLForm:
2530 """Represents a single HTML <form> ... </form> element.
2531
2532 A form consists of a sequence of controls that usually have names, and
2533 which can take on various values. The values of the various types of
2534 controls represent variously: text, zero-or-one-of-many or many-of-many
2535 choices, and files to be uploaded. Some controls can be clicked on to
2536 submit the form, and clickable controls&#x27; values sometimes include the
2537 coordinates of the click.
2538
2539 Forms can be filled in with data to be returned to the server, and then
2540 submitted, using the click method to generate a request object suitable for
2541 passing to urllib2.urlopen (or the click_request_data or click_pairs
2542 methods if you&#x27;re not using urllib2).
2543
2544 import ClientForm
2545 forms = ClientForm.ParseFile(html, base_uri)
2546 form = forms[0]
2547
2548 form["query"] = "Python"
2549 form.find_control("nr_results").get("lots").selected = True
2550
2551 response = urllib2.urlopen(form.click())
2552
2553 Usually, HTMLForm instances are not created directly. Instead, the
2554 ParseFile or ParseResponse factory functions are used. If you do construct
2555 HTMLForm objects yourself, however, note that an HTMLForm instance is only
2556 properly initialised after the fixup method has been called (ParseFile and
2557 ParseResponse do this for you). See ListControl.__doc__ for the reason
2558 this is required.
2559
2560 Indexing a form (form["control_name"]) returns the named Control&#x27;s value
2561 attribute. Assignment to a form index (form["control_name"] = something)
2562 is equivalent to assignment to the named Control&#x27;s value attribute. If you
2563 need to be more specific than just supplying the control&#x27;s name, use the
2564 set_value and get_value methods.
2565
2566 ListControl values are lists of item names (specifically, the names of the
2567 items that are selected and not disabled, and hence are "successful" -- ie.
2568 cause data to be returned to the server). The list item&#x27;s name is the
2569 value of the corresponding HTML element&#x27;s"value" attribute.
2570
2571 Example:
2572
2573 <INPUT type="CHECKBOX" name="cheeses" value="leicester"></INPUT>
2574 <INPUT type="CHECKBOX" name="cheeses" value="cheddar"></INPUT>
2575
2576 defines a CHECKBOX control with name "cheeses" which has two items, named
2577 "leicester" and "cheddar".
2578
2579 Another example:
2580
2581 <SELECT name="more_cheeses">
2582 <OPTION>1</OPTION>
2583 <OPTION value="2" label="CHEDDAR">cheddar</OPTION>
2584 </SELECT>
2585
2586 defines a SELECT control with name "more_cheeses" which has two items,

Callers 1

_ParseFileExFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…