
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
com.github.httpmock:mock-http-server-exec
Advanced tools
With this mock http server you can write integration tests for your application and mock its http based backends. This example shows an integration test which configures the mock to answer for a specific request with a specific response. It also shows how to use this mock server with junit.
import static com.github.httpmock.builder.RequestBuilder.request;
import static com.github.httpmock.builder.ResponseBuilder.response;
import static com.github.httpmock.times.ExcatlyOnce.once;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import com.github.httpmock.dto.RequestDto;
import com.github.httpmock.dto.ResponseDto;
import com.jayway.restassured.response.Response;
public class ExampleIT {
@ClassRule
public static HttpMockServer mockServer = new HttpMockServer();
@Rule
public HttpMock mock = new HttpMock(mockServer);
@Test
public void someTest() throws Exception {
RequestDto request = request().method("POST").url("/some/url").build();
ResponseDto response = response().payload("data")
.contentType("text/plain").build();
mock.when(request).thenRespond(response);
Response mockResponse = given().baseUri(getBaseUri())
.basePath(mock.getRequestUrl()).post("/some/url");
assertThat(mockResponse.getBody().asString(), is("data"));
assertThat(mockResponse.getContentType(), is("text/plain"));
mock.verify(request, once());
}
private String getBaseUri() {
return String.format("http://localhost:%d", mockServer.getPort());
}
}
FAQs
Mock HTTP Server - Executable
We found that com.github.httpmock:mock-http-server-exec demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.