Bugzilla – Attachment 790163 Details for
Bug 1116568
yast2 hostnames can freeze OS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
script to generate hosts files
large_hosts.py (text/x-python), 871 bytes, created by
Alexander Graul
on 2018-11-19 13:23:02 UTC
(
hide
)
Description:
script to generate hosts files
Filename:
MIME Type:
Creator:
Alexander Graul
Created:
2018-11-19 13:23:02 UTC
Size:
871 bytes
patch
obsolete
>#!/usr/bin/python3 ># ># HOW TO: ># start the script as ./large_hosts.py FILENAME NUMBER_OF_LINES ># e.g. ./large_hosts.py /etc/hosts 500 ># Remember to make a backup first! ># >import random >import string >import sys > > >def generate_dummy_entry(): > ip = '.'.join([str(random.randint(1, 254)) for i in range(4)]) > hostname = ''.join([random.choice(string.ascii_letters) for i in range(15)]) > aliases = [''.join([random.choice(string.ascii_letters) for i in range(15)]) for i in range(3)] > > return '{ip}\t{hostname} {aliases}'.format(ip=ip, hostname=hostname, aliases=' '.join(aliases)) > >def generate_x_entries(x): > return [generate_dummy_entry() for i in range(x)] > > >if __name__ == '__main__': > if len(sys.argv) < 3: > sys.exit() > > with open(sys.argv[1], 'w') as f: > f.write('\n'.join(generate_x_entries(int(sys.argv[2])))) > f.write('\n')
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 1116568
: 790163 |
790165
|
790168