|
import random |
|
|
|
def get_useragent(): |
|
""" |
|
Generates a random user agent string mimicking the format of various software versions. |
|
|
|
The user agent string is composed of: |
|
- Lynx version: Lynx/x.y.z where x is 2-3, y is 8-9, and z is 0-2 |
|
- libwww version: libwww-FM/x.y where x is 2-3 and y is 13-15 |
|
- SSL-MM version: SSL-MM/x.y where x is 1-2 and y is 3-5 |
|
- OpenSSL version: OpenSSL/x.y.z where x is 1-3, y is 0-4, and z is 0-9 |
|
|
|
Returns: |
|
str: A randomly generated user agent string. |
|
""" |
|
lynx_version = f"Lynx/{random.randint(2, 3)}.{random.randint(8, 9)}.{random.randint(0, 2)}" |
|
libwww_version = f"libwww-FM/{random.randint(2, 3)}.{random.randint(13, 15)}" |
|
ssl_mm_version = f"SSL-MM/{random.randint(1, 2)}.{random.randint(3, 5)}" |
|
openssl_version = f"OpenSSL/{random.randint(1, 3)}.{random.randint(0, 4)}.{random.randint(0, 9)}" |
|
return f"{lynx_version} {libwww_version} {ssl_mm_version} {openssl_version}" |