0

Rookie Coder here, I was able to successfully run the following API call using Curl: username and password have been sanitized for security purposes

curl -H "X-Requested-With: Curl Sample" -u "username:password" "https://qualysapi.qg2.apps.qualys.com/api/2.0/fo/scan/?action=list"

This call simply lists the Qualys scans associated with the account.

I try and run the same API call using Python 3.10 and it finishes however, no data is returned without error. Process finished with exit code 0

Python Script below:

from __future__ import print_function
import sqlite3
from sqlite3 import Error
import requests
import pandas as pd
import os
import csv
import time
from tqdm import tqdm
import sys, getopt
import codecs
import warnings
from pprint import pprint
import json
import pyfiglet
from openpyxl import Workbook
from datetime import datetime


'''Function to call Qualys API For Vulnerability Scan List Module'''
def QualysScanAPI(act, stat):
    print ('qualysapi.qg2.apps.qualys.com/api/2.0/fo/scan/?action=list')
    headers = {
    'X-Requested-With': 'QualysApiExplorer',
    }
    data = {
      'action': list,
      'state': stat,
      '': ''
    }


    response = requests.post('https://qualysapi.qg2.apps.qualys.com/api/2.0/fo/scan/?action=list', headers=headers, data=data, auth=('username', 'password'))

    return response.content

    print(response.content)
WadeAlex
  • 1
  • 1

1 Answers1

-1

I would suggest using the qualysapi library:

https://pypi.org/project/qualysapi/

Much easier making the calls you're looking for.

API
  • 1