├── LICENSE
├── README.md
├── app
├── build.gradle.kts
├── proguard-rules.pro
├── release
│ ├── baselineProfiles
│ │ ├── 0
│ │ │ └── app-release.dm
│ │ └── 1
│ │ │ └── app-release.dm
│ └── output-metadata.json
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── nemesis
│ │ └── mocktraffic
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── config.json
│ ├── java
│ │ └── com
│ │ │ └── nemesis
│ │ │ └── mocktraffic
│ │ │ ├── MainActivity.java
│ │ │ └── TrafficService.java
│ └── res
│ │ ├── drawable
│ │ └── ic_launcher.png
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ └── ic_launcher.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_monochrome.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_monochrome.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_monochrome.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_monochrome.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_monochrome.png
│ │ ├── values-night
│ │ └── themes.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ │ └── xml
│ │ ├── backup_rules.xml
│ │ └── data_extraction_rules.xml
│ └── test
│ └── java
│ └── com
│ └── nemesis
│ └── mocktraffic
│ └── ExampleUnitTest.java
├── build.gradle.kts
├── fastlane
└── metadata
│ └── android
│ └── en-US
│ ├── full_description.txt
│ ├── images
│ ├── icon.png
│ └── phoneScreenshots
│ │ └── image.png
│ ├── short_description.txt
│ └── title.txt
├── gradle.properties
├── gradle
├── libs.versions.toml
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── image.png
├── local.properties
└── settings.gradle.kts
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Nemesis
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MockTraffic
2 | ## A random DNS, HTTPS internet traffic noise generator for Android
3 |
4 | ## Description:
5 |
6 | A random DNS and HTTPS internet traffic noise generator provides enhanced privacy and security by obfuscating users' online activities. It generates random, non-user-initiated queries to DNS servers and encrypted HTTPS connections, making it difficult for third parties such as ISPs, surveillance systems, or malicious actors to analyze and track actual browsing patterns. This added layer of traffic noise reduces the effectiveness of traffic analysis and profiling techniques, making it harder to identify specific behaviors, websites, or services accessed by the user.
7 |
8 |
9 | ## Features:
10 |
11 | - Small codebase
12 |
13 | - Runs in the background
14 |
15 | - Built in Java
16 |
17 |
18 | ## Installation:
19 |
20 | [Download](https://github.com/umutcamliyurt/MockTraffic/releases)
21 |
22 |
23 | ## Screenshot:
24 |
25 |
26 |
27 |
28 | ## License
29 |
30 | Distributed under the MIT License. See `LICENSE` for more information.
31 |
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.android.application)
3 | }
4 |
5 | android {
6 | namespace = "com.nemesis.mocktraffic"
7 | compileSdk = 34
8 |
9 | defaultConfig {
10 | applicationId = "com.nemesis.mocktraffic"
11 | minSdk = 24
12 | targetSdk = 34
13 | versionCode = 2
14 | versionName = "1.1"
15 |
16 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
17 |
18 | dependenciesInfo {
19 | // Disables dependency metadata when building APKs.
20 | includeInApk = false
21 | // Disables dependency metadata when building Android App Bundles.
22 | includeInBundle = false
23 | }
24 | }
25 |
26 | buildTypes {
27 | release {
28 | isMinifyEnabled = false
29 | proguardFiles(
30 | getDefaultProguardFile("proguard-android-optimize.txt"),
31 | "proguard-rules.pro"
32 | )
33 | }
34 | }
35 | compileOptions {
36 | sourceCompatibility = JavaVersion.VERSION_1_8
37 | targetCompatibility = JavaVersion.VERSION_1_8
38 | }
39 | }
40 |
41 | dependencies {
42 |
43 | implementation(libs.appcompat)
44 | implementation(libs.material)
45 | implementation(libs.okhttp)
46 | implementation(libs.jsoup)
47 | testImplementation(libs.junit)
48 | androidTestImplementation(libs.ext.junit)
49 | androidTestImplementation(libs.espresso.core)
50 | }
51 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/release/baselineProfiles/0/app-release.dm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/release/baselineProfiles/0/app-release.dm
--------------------------------------------------------------------------------
/app/release/baselineProfiles/1/app-release.dm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/release/baselineProfiles/1/app-release.dm
--------------------------------------------------------------------------------
/app/release/output-metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 3,
3 | "artifactType": {
4 | "type": "APK",
5 | "kind": "Directory"
6 | },
7 | "applicationId": "com.nemesis.mocktraffic",
8 | "variantName": "release",
9 | "elements": [
10 | {
11 | "type": "SINGLE",
12 | "filters": [],
13 | "attributes": [],
14 | "versionCode": 1,
15 | "versionName": "1.0",
16 | "outputFile": "app-release.apk"
17 | }
18 | ],
19 | "elementType": "File",
20 | "baselineProfiles": [
21 | {
22 | "minApi": 28,
23 | "maxApi": 30,
24 | "baselineProfiles": [
25 | "baselineProfiles/1/app-release.dm"
26 | ]
27 | },
28 | {
29 | "minApi": 31,
30 | "maxApi": 2147483647,
31 | "baselineProfiles": [
32 | "baselineProfiles/0/app-release.dm"
33 | ]
34 | }
35 | ],
36 | "minSdkVersionForDexing": 24
37 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/nemesis/mocktraffic/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.nemesis.mocktraffic;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.nemesis.mocktraffic", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
22 |
23 |
24 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/nemesis/mocktraffic/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.nemesis.mocktraffic;
2 |
3 | import android.Manifest;
4 | import android.app.AlertDialog;
5 | import android.content.BroadcastReceiver;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.content.IntentFilter;
9 | import android.content.SharedPreferences;
10 | import android.content.pm.PackageManager;
11 | import android.os.Build;
12 | import android.os.Bundle;
13 | import android.os.PowerManager;
14 | import android.provider.Settings;
15 | import android.widget.CheckBox;
16 | import android.widget.TextView;
17 | import android.widget.Toast;
18 |
19 | import androidx.annotation.NonNull;
20 | import androidx.appcompat.app.AppCompatActivity;
21 | import androidx.core.app.ActivityCompat;
22 | import androidx.core.content.ContextCompat;
23 |
24 | public class MainActivity extends AppCompatActivity {
25 |
26 | private static final int REQUEST_POST_NOTIFICATIONS = 1;
27 | private static final int REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = 2;
28 |
29 | private CheckBox trafficCheckBox;
30 | private TextView trafficStatsTextView;
31 | private TextView statusTextView;
32 |
33 | private BroadcastReceiver statsReceiver = new BroadcastReceiver() {
34 | @Override
35 | public void onReceive(Context context, Intent intent) {
36 | if (TrafficService.ACTION_UPDATE_STATS.equals(intent.getAction())) {
37 | int requestCount = intent.getIntExtra("requestCount", 0);
38 | trafficStatsTextView.setText("Traffic Stats: " + requestCount + " requests");
39 |
40 | // Save request count to SharedPreferences
41 | SharedPreferences preferences = getSharedPreferences("app_prefs", MODE_PRIVATE);
42 | SharedPreferences.Editor editor = preferences.edit();
43 | editor.putInt("request_count", requestCount);
44 | editor.apply();
45 | }
46 | }
47 | };
48 |
49 | @Override
50 | protected void onCreate(Bundle savedInstanceState) {
51 | super.onCreate(savedInstanceState);
52 | setContentView(R.layout.activity_main);
53 |
54 | // Initialize UI elements
55 | trafficCheckBox = findViewById(R.id.trafficCheckBox);
56 | trafficStatsTextView = findViewById(R.id.trafficStatsTextView);
57 | statusTextView = findViewById(R.id.statusTextView);
58 |
59 | // Restore saved traffic generation setting
60 | SharedPreferences preferences = getSharedPreferences("app_prefs", MODE_PRIVATE);
61 | boolean trafficEnabled = preferences.getBoolean("traffic_enabled", false);
62 | trafficCheckBox.setChecked(trafficEnabled);
63 |
64 | // Restore the saved request count
65 | int savedRequestCount = preferences.getInt("request_count", 0);
66 | trafficStatsTextView.setText("Traffic Stats: " + savedRequestCount + " requests");
67 |
68 | // Check and request POST_NOTIFICATIONS permission if needed
69 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { // Android 13+
70 | if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
71 | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.POST_NOTIFICATIONS}, REQUEST_POST_NOTIFICATIONS);
72 | }
73 | }
74 |
75 | // Toggle traffic generation when checkbox is clicked
76 | trafficCheckBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
77 | // Save the traffic generation setting
78 | SharedPreferences.Editor editor = preferences.edit();
79 | editor.putBoolean("traffic_enabled", isChecked);
80 | editor.apply();
81 |
82 | if (isChecked) {
83 | // Check if POST_NOTIFICATIONS permission is granted (Android 13+)
84 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
85 | if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
86 | Toast.makeText(this, "Notification permission required to enable traffic generation.", Toast.LENGTH_LONG).show();
87 | trafficCheckBox.setChecked(false);
88 | return;
89 | }
90 | }
91 |
92 | // Request to ignore battery optimizations
93 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // Android 6.0+
94 | PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
95 | if (pm != null && !pm.isIgnoringBatteryOptimizations(getPackageName())) {
96 | Intent intentExempt = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
97 | intentExempt.setData(android.net.Uri.parse("package:" + getPackageName()));
98 | startActivityForResult(intentExempt, REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
99 | return; // Wait for user to respond
100 | }
101 | }
102 |
103 | // Start the TrafficService
104 | Intent serviceIntent = new Intent(this, TrafficService.class);
105 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
106 | startForegroundService(serviceIntent);
107 | } else {
108 | startService(serviceIntent);
109 | }
110 | Toast.makeText(this, "Traffic Generation Enabled", Toast.LENGTH_SHORT).show();
111 | statusTextView.setText("Traffic Generation Enabled");
112 | } else {
113 | // Stop the TrafficService
114 | Intent serviceIntent = new Intent(this, TrafficService.class);
115 | stopService(serviceIntent);
116 | Toast.makeText(this, "Traffic Generation Disabled", Toast.LENGTH_SHORT).show();
117 | statusTextView.setText("Traffic Generation Disabled");
118 | }
119 | });
120 | }
121 |
122 | @Override
123 | protected void onResume() {
124 | super.onResume();
125 | // Register the receiver
126 | IntentFilter filter = new IntentFilter(TrafficService.ACTION_UPDATE_STATS);
127 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { // Android 13 and above
128 | registerReceiver(statsReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
129 | } else {
130 | registerReceiver(statsReceiver, filter); // Older versions
131 | }
132 | }
133 |
134 | @Override
135 | protected void onPause() {
136 | super.onPause();
137 | // Unregister the receiver to prevent leaks
138 | unregisterReceiver(statsReceiver);
139 | }
140 |
141 | // Handle the result of permission requests
142 | @Override
143 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
144 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
145 | if (requestCode == REQUEST_POST_NOTIFICATIONS) {
146 | if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
147 | // Permission granted; no action needed
148 | Toast.makeText(this, "Notification permission granted.", Toast.LENGTH_SHORT).show();
149 | } else {
150 | // Permission denied
151 | Toast.makeText(this, "Notification permission denied. Cannot enable traffic generation.", Toast.LENGTH_LONG).show();
152 | trafficCheckBox.setChecked(false);
153 | }
154 | }
155 | }
156 |
157 | // Handle the result of battery optimization exemption request
158 | @Override
159 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
160 | super.onActivityResult(requestCode, resultCode, data);
161 | if (requestCode == REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) {
162 | PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
163 | if (pm != null && pm.isIgnoringBatteryOptimizations(getPackageName())) {
164 | // User granted exemption
165 | Toast.makeText(this, "Battery optimization exemption granted.", Toast.LENGTH_SHORT).show();
166 |
167 | // Start the TrafficService
168 | Intent serviceIntent = new Intent(this, TrafficService.class);
169 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
170 | startForegroundService(serviceIntent);
171 | } else {
172 | startService(serviceIntent);
173 | }
174 | statusTextView.setText("Traffic Generation Enabled");
175 | } else {
176 | // User denied exemption
177 | Toast.makeText(this, "Battery optimization exemption denied. Traffic generation may be limited.", Toast.LENGTH_LONG).show();
178 | trafficCheckBox.setChecked(false);
179 |
180 | // Optionally, show a dialog explaining why the exemption is needed
181 | new AlertDialog.Builder(this)
182 | .setTitle("Battery Optimization")
183 | .setMessage("To ensure reliable traffic generation, please allow the app to ignore battery optimizations in settings.")
184 | .setPositiveButton("Open Settings", (dialog, which) -> {
185 | Intent intentExempt = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
186 | startActivity(intentExempt);
187 | })
188 | .setNegativeButton("Cancel", null)
189 | .show();
190 | }
191 | }
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/app/src/main/java/com/nemesis/mocktraffic/TrafficService.java:
--------------------------------------------------------------------------------
1 | package com.nemesis.mocktraffic;
2 |
3 | import android.app.Notification;
4 | import android.app.NotificationChannel;
5 | import android.app.NotificationManager;
6 | import android.app.PendingIntent;
7 | import android.app.Service;
8 | import android.content.Intent;
9 | import android.content.res.AssetManager;
10 | import android.os.Build;
11 | import android.os.Handler;
12 | import android.os.IBinder;
13 | import android.util.Log;
14 |
15 | import androidx.annotation.Nullable;
16 | import androidx.core.app.NotificationCompat;
17 |
18 | import org.json.JSONArray;
19 | import org.json.JSONException;
20 | import org.json.JSONObject;
21 | import org.jsoup.Jsoup;
22 | import org.jsoup.nodes.Document;
23 | import org.jsoup.select.Elements;
24 |
25 | import java.io.BufferedReader;
26 | import java.io.IOException;
27 | import java.io.InputStream;
28 | import java.io.InputStreamReader;
29 | import java.util.ArrayList;
30 | import java.util.List;
31 | import java.util.Random;
32 |
33 | import okhttp3.Call;
34 | import okhttp3.Callback;
35 | import okhttp3.OkHttpClient;
36 | import okhttp3.Request;
37 | import okhttp3.Response;
38 |
39 | public class TrafficService extends Service {
40 |
41 | // Notification Channel ID
42 | private static final String CHANNEL_ID = "TrafficServiceChannel";
43 | private static final int NOTIFICATION_ID = 1;
44 |
45 | // Broadcast Action
46 | public static final String ACTION_UPDATE_STATS = "com.nemesis.mocktraffic.ACTION_UPDATE_STATS";
47 |
48 | // State variables
49 | private boolean isTrafficEnabled = true; // Service is started only when traffic is enabled
50 | private int requestCount = 0;
51 | private List urlsToVisit = new ArrayList<>();
52 | private List blacklistedUrls = new ArrayList<>();
53 | private int maxDepth = 5;
54 | private int minSleep = 2000; // in milliseconds
55 | private int maxSleep = 5000; // in milliseconds
56 | private int timeout = 60000; // 60 seconds timeout
57 | private Handler trafficHandler = new Handler();
58 | private Handler logCleanerHandler = new Handler();
59 | private OkHttpClient httpClient = new OkHttpClient();
60 | private Random random = new Random();
61 |
62 | private static final int LOG_CLEAN_INTERVAL = 30000; // Clean the log every 30 seconds
63 |
64 | @Override
65 | public void onCreate() {
66 | super.onCreate();
67 | Log.d("TrafficService", "Service created.");
68 | createNotificationChannel();
69 | loadConfigFromAssets(); // Load config when service is created
70 | }
71 |
72 | // Create the notification channel for Android O and above
73 | private void createNotificationChannel() {
74 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
75 | CharSequence name = "Traffic Service Channel";
76 | String description = "Channel for Traffic Generation Service";
77 | int importance = NotificationManager.IMPORTANCE_LOW; // Low importance to avoid sound
78 | NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
79 | channel.setDescription(description);
80 | // Register the channel with the system
81 | NotificationManager notificationManager = getSystemService(NotificationManager.class);
82 | if (notificationManager != null) {
83 | notificationManager.createNotificationChannel(channel);
84 | Log.d("TrafficService", "Notification channel created.");
85 | } else {
86 | Log.e("TrafficService", "NotificationManager is null.");
87 | }
88 | }
89 | }
90 |
91 | // Build the persistent notification
92 | private Notification buildNotification() {
93 | Intent notificationIntent = new Intent(this, MainActivity.class);
94 | PendingIntent pendingIntent;
95 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
96 | pendingIntent = PendingIntent.getActivity(this,
97 | 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
98 | } else {
99 | pendingIntent = PendingIntent.getActivity(this,
100 | 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
101 | }
102 |
103 | return new NotificationCompat.Builder(this, CHANNEL_ID)
104 | .setContentTitle("Traffic Generation Active")
105 | .setContentText("Generating traffic in the background")
106 | .setSmallIcon(R.drawable.ic_launcher) // Ensure you have an icon named ic_traffic
107 | .setContentIntent(pendingIntent)
108 | .setOngoing(true) // Make the notification persistent
109 | .build();
110 | }
111 |
112 | // Start the service in the foreground with the notification
113 | @Override
114 | public int onStartCommand(Intent intent, int flags, int startId) {
115 | Log.d("TrafficService", "onStartCommand called.");
116 | // Start as foreground service
117 | Notification notification = buildNotification();
118 | startForeground(NOTIFICATION_ID, notification);
119 | Log.d("TrafficService", "Foreground service started.");
120 |
121 | // Start traffic generation
122 | startTraffic();
123 |
124 | return START_STICKY; // Service will be restarted if terminated
125 | }
126 |
127 | // Stop the service
128 | @Override
129 | public void onDestroy() {
130 | super.onDestroy();
131 | stopTraffic(); // Stop traffic generation when service is destroyed
132 | Log.d("TrafficService", "Service destroyed.");
133 | }
134 |
135 | @Nullable
136 | @Override
137 | public IBinder onBind(Intent intent) {
138 | return null; // Binding not used
139 | }
140 |
141 | // Method to start traffic generation
142 | private void startTraffic() {
143 | if (urlsToVisit.isEmpty()) {
144 | Log.e("TrafficService", "No URLs to visit. Check config.json");
145 | stopSelf(); // Stop service if no URLs are available
146 | return;
147 | }
148 |
149 | trafficHandler.post(trafficRunnable); // Start the traffic generation loop
150 | scheduleLogCleaning(); // Start log cleaning
151 | Log.d("TrafficService", "Traffic generation started.");
152 | }
153 |
154 | // Method to stop traffic generation
155 | private void stopTraffic() {
156 | trafficHandler.removeCallbacks(trafficRunnable); // Stop traffic generation loop
157 | logCleanerHandler.removeCallbacksAndMessages(null); // Stop log cleaning
158 | Log.d("TrafficService", "Traffic generation stopped.");
159 | }
160 |
161 | // Runnable that handles traffic generation by crawling and making HTTP requests
162 | private Runnable trafficRunnable = new Runnable() {
163 | @Override
164 | public void run() {
165 | Log.d("TrafficService", "Traffic runnable started. URLs to visit: " + urlsToVisit.size());
166 | if (isTrafficEnabled && !urlsToVisit.isEmpty()) {
167 | String urlToVisit = urlsToVisit.get(random.nextInt(urlsToVisit.size()));
168 | Log.d("TrafficService", "Visiting URL: " + urlToVisit);
169 | makeHttpRequest(urlToVisit);
170 |
171 | // Schedule the next traffic request after a random delay
172 | int sleepTime = random.nextInt(maxSleep - minSleep + 1) + minSleep;
173 | trafficHandler.postDelayed(this, sleepTime);
174 | } else {
175 | Log.d("TrafficService", "Traffic generation stopped or no URLs to visit.");
176 | stopSelf(); // Stop the service if traffic is disabled or no URLs
177 | }
178 | }
179 | };
180 |
181 | // Method to make an HTTP request to a given URL
182 | private void makeHttpRequest(final String url) {
183 | if (!url.startsWith("http://") && !url.startsWith("https://")) {
184 | Log.e("TrafficService", "Invalid URL scheme: " + url);
185 | return; // Skip this URL since it's not an HTTP/HTTPS URL
186 | }
187 |
188 | Request request = new Request.Builder()
189 | .url(url)
190 | .build();
191 |
192 | httpClient.newCall(request).enqueue(new Callback() {
193 | @Override
194 | public void onFailure(Call call, IOException e) {
195 | Log.e("TrafficService", "Failed to load URL: " + url, e);
196 | }
197 |
198 | @Override
199 | public void onResponse(Call call, Response response) throws IOException {
200 | if (response.isSuccessful()) {
201 | requestCount++; // Increment request count on success
202 | broadcastStats(); // Broadcast the updated stats
203 | Log.d("TrafficService", "Visited URL: " + url + " | Status: " + response.code());
204 |
205 | // Extract URLs from the response body and add to visit list
206 | String body = response.body().string();
207 | List extractedUrls = extractUrlsFromBody(body, url);
208 | synchronized (urlsToVisit) {
209 | urlsToVisit.addAll(extractedUrls); // Add extracted URLs to the list
210 | }
211 | } else {
212 | Log.e("TrafficService", "Failed to visit URL: " + url + " | Status: " + response.code());
213 | }
214 | }
215 | });
216 | }
217 |
218 |
219 | // Broadcast the updated stats
220 | private void broadcastStats() {
221 | Intent intent = new Intent(ACTION_UPDATE_STATS);
222 | intent.putExtra("requestCount", requestCount);
223 | sendBroadcast(intent);
224 | Log.d("TrafficService", "Broadcasted stats: " + requestCount);
225 | }
226 |
227 | // Clean the log periodically (if logging to a file or similar)
228 | private void scheduleLogCleaning() {
229 | logCleanerHandler.postDelayed(new Runnable() {
230 | @Override
231 | public void run() {
232 | // Implement log cleaning logic if needed
233 | Log.d("TrafficService", "Log cleaned.");
234 | logCleanerHandler.postDelayed(this, LOG_CLEAN_INTERVAL); // Schedule next cleaning
235 | }
236 | }, LOG_CLEAN_INTERVAL);
237 | }
238 |
239 | // Load config.json file and populate urlsToVisit and blacklistedUrls
240 | private void loadConfigFromAssets() {
241 | String jsonString = null;
242 | try {
243 | AssetManager assetManager = getAssets();
244 | InputStream inputStream = assetManager.open("config.json");
245 | BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
246 | StringBuilder stringBuilder = new StringBuilder();
247 | String line;
248 |
249 | while ((line = reader.readLine()) != null) {
250 | stringBuilder.append(line);
251 | }
252 | jsonString = stringBuilder.toString();
253 | reader.close();
254 |
255 | // Parse the JSON config file
256 | parseJsonConfig(jsonString);
257 | Log.d("TrafficService", "Configuration loaded successfully.");
258 |
259 | } catch (IOException e) {
260 | Log.e("TrafficService", "Error reading config.json", e);
261 | stopSelf(); // Stop service if config cannot be loaded
262 | }
263 | }
264 |
265 | // Parse the configuration JSON and populate urlsToVisit and blacklistedUrls
266 | private void parseJsonConfig(String jsonString) {
267 | try {
268 | JSONObject jsonObject = new JSONObject(jsonString);
269 |
270 | JSONArray rootUrls = jsonObject.getJSONArray("root_urls");
271 | JSONArray blacklistedUrlsJson = jsonObject.getJSONArray("blacklisted_urls");
272 |
273 | for (int i = 0; i < rootUrls.length(); i++) {
274 | urlsToVisit.add(rootUrls.getString(i)); // Add URLs from config to visit list
275 | }
276 |
277 | for (int i = 0; i < blacklistedUrlsJson.length(); i++) {
278 | blacklistedUrls.add(blacklistedUrlsJson.getString(i)); // Add blacklisted URLs
279 | }
280 |
281 | // Update additional configurations
282 | maxDepth = jsonObject.getInt("max_depth");
283 | minSleep = jsonObject.getInt("min_sleep");
284 | maxSleep = jsonObject.getInt("max_sleep");
285 | timeout = jsonObject.optInt("timeout", 60000); // Default to 60 seconds if not provided
286 |
287 | Log.d("TrafficService", "Parsed config.json: " + jsonObject.toString());
288 |
289 | } catch (JSONException e) {
290 | Log.e("TrafficService", "Error parsing config.json", e);
291 | stopSelf(); // Stop service if config cannot be parsed
292 | }
293 | }
294 |
295 | // Extract URLs from the HTML response using Jsoup
296 | private List extractUrlsFromBody(String body, String rootUrl) {
297 | List extractedUrls = new ArrayList<>();
298 | try {
299 | Document doc = Jsoup.parse(body, rootUrl);
300 | Elements links = doc.select("a[href]"); // Select all tags with href attributes
301 |
302 | for (org.jsoup.nodes.Element link : links) {
303 | String absoluteUrl = link.absUrl("href"); // Get absolute URLs
304 | if (!absoluteUrl.isEmpty() && !urlsToVisit.contains(absoluteUrl) && !isBlacklisted(absoluteUrl)) {
305 | extractedUrls.add(absoluteUrl); // Add valid URLs to the list
306 | }
307 | }
308 | } catch (Exception e) {
309 | Log.e("TrafficService", "Failed to extract URLs", e);
310 | }
311 | return extractedUrls;
312 | }
313 |
314 | // Check if a URL is blacklisted
315 | private boolean isBlacklisted(String url) {
316 | for (String blacklistedUrl : blacklistedUrls) {
317 | if (url.contains(blacklistedUrl)) {
318 | return true;
319 | }
320 | }
321 | return false;
322 | }
323 | }
324 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
14 |
15 |
16 |
24 |
25 |
26 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-hdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-mdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MockTraffic
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/app/src/test/java/com/nemesis/mocktraffic/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.nemesis.mocktraffic;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | plugins {
3 | alias(libs.plugins.android.application) apply false
4 | }
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/full_description.txt:
--------------------------------------------------------------------------------
1 | Description:
2 |
3 | A random DNS and HTTPS internet traffic noise generator provides enhanced privacy and security by obfuscating users' online activities. It generates random, non-user-initiated queries to DNS servers and encrypted HTTPS connections, making it difficult for third parties such as ISPs, surveillance systems, or malicious actors to analyze and track actual browsing patterns. This added layer of traffic noise reduces the effectiveness of traffic analysis and profiling techniques, making it harder to identify specific behaviors, websites, or services accessed by the user.
4 |
5 | Features:
6 |
7 | - Small codebase
8 |
9 | - Runs in the background
10 |
11 | - Built in Java
12 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/fastlane/metadata/android/en-US/images/icon.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/fastlane/metadata/android/en-US/images/phoneScreenshots/image.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/short_description.txt:
--------------------------------------------------------------------------------
1 | A random DNS, HTTPS internet traffic noise generator for Android
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/title.txt:
--------------------------------------------------------------------------------
1 | MockTraffic
2 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. For more details, visit
12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Enables namespacing of each library's R class so that its R class includes only the
19 | # resources declared in the library itself and none from the library's dependencies,
20 | # thereby reducing the size of the R class for that library
21 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.4.0"
3 | junit = "4.13.2"
4 | junitVersion = "1.2.1"
5 | espressoCore = "3.6.1"
6 | appcompat = "1.7.0"
7 | material = "1.12.0"
8 | okhttp = "5.0.0-alpha.14"
9 | jsoup = "1.18.1"
10 |
11 | [libraries]
12 | junit = { group = "junit", name = "junit", version.ref = "junit" }
13 | ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
14 | espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
15 | appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
16 | material = { group = "com.google.android.material", name = "material", version.ref = "material" }
17 | okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
18 | jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" }
19 |
20 | [plugins]
21 | android-application = { id = "com.android.application", version.ref = "agp" }
22 |
23 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Oct 16 19:03:17 MSK 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutcamliyurt/MockTraffic/9b053e2ed274f59a5fcde698804a7af4b95da597/image.png
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by Android Studio.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file should *NOT* be checked into Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 | #
7 | # Location of the SDK. This is only used by Gradle.
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | sdk.dir=/mnt/15f4cd83-eef3-4164-8cd3-20c791446b9e/Tools/Android/Sdk
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google {
4 | content {
5 | includeGroupByRegex("com\\.android.*")
6 | includeGroupByRegex("com\\.google.*")
7 | includeGroupByRegex("androidx.*")
8 | }
9 | }
10 | mavenCentral()
11 | gradlePluginPortal()
12 | }
13 | }
14 | dependencyResolutionManagement {
15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
16 | repositories {
17 | google()
18 | mavenCentral()
19 | }
20 | }
21 |
22 | rootProject.name = "MockTraffic"
23 | include(":app")
24 |
--------------------------------------------------------------------------------