The public_ip function within the mock-jutsu library is a specialised tool designed to generate realistic, public-facing IPv4 addresses. In the modern landscape of software development and cybersecurity testing, having access to high-quality mock data is essential for simulating authentic internet traffic patterns. This function enables developers to populate application logs, database records, and network packets with valid IP addresses that represent external entities, ensuring that systems are prepared to handle traffic from the global web rather than just local network environments.
Following established IPv4 networking standards, the algorithm used by public_ip generates values that purposefully exclude private and reserved address ranges. By avoiding blocks such as 192.168.x.x or 10.x.x.x, mock-jutsu provides high-fidelity test data that accurately reflects traffic originating from outside a corporate firewall. This precision is particularly beneficial when testing security-centric features like IP whitelisting, rate limiting, and geolocation-based access controls, where the distinction between internal and external network traffic is critical for functional accuracy and system integrity.
Integration is a core strength of the mock-jutsu ecosystem, and the public_ip function is available across multiple interfaces to suit various developer workflows. Engineers can programmatically generate addresses in Python with jutsu.generate('public_ip'), while DevOps specialists might prefer the CLI command "mockjutsu generate public_ip" for rapid shell scripting. Furthermore, performance testers can leverage the function directly in JMeter using the ${__mockjutsu(public_ip,)} syntax. This cross-platform flexibility ensures that the same standard of test data remains accessible throughout the entire software development lifecycle, from initial unit testing to large-scale load simulations.
Using public_ip also helps teams avoid the legal and ethical complexities of using real user data for testing purposes. By generating synthetic but structurally correct IP addresses, engineers can build robust analytics dashboards and audit trails without compromising privacy or violating data protection regulations. Whether you are debugging a complex networking issue or stress-testing a global API, the public_ip function provides the reliability and variety needed to ensure your application performs optimally under demanding real-world conditions.
mockjutsu generate public_ipmockjutsu bulk public_ip --count 10mockjutsu export public_ip --count 10 --format jsonmockjutsu export public_ip --count 10 --format csvmockjutsu export public_ip --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate public_ip --maskmockjutsu bulk public_ip --count 5 --maskfrom mockjutsu import jutsujutsu.generate('public_ip')jutsu.bulk('public_ip', count=10)jutsu.template(['public_ip'], count=5)# mask=True: regulation-compliant outputjutsu.generate('public_ip', mask=True)jutsu.bulk('public_ip', count=5, mask=True)${__mockjutsu_security(public_ip)}# JMeter Function: __mockjutsu_security# Parameter 1: public_ip# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_security(public_ip,mask)}GET /generate/public_ip# → {"type":"public_ip","result":"...","status":"ok"}GET /bulk/public_ip?count=10POST /template {"types":["public_ip"],"count":1}# mask=true: regulation-compliant outputGET /generate/public_ip?mask=trueGET /bulk/public_ip?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |