Esempio n. 1
0
HRESULT sync(PSTR Args)
{
	HRESULT hRes = S_OK;

	// Reset global state
	g_Base = NULL;
	g_Offset = NULL;

	if (g_Synchronized)
	{
		_plugin_logputs("[sync] sync update\n");
		UpdateState();
		goto Exit;
	}

	if (FAILED(hRes = TunnelCreate(g_DefaultHost, g_DefaultPort)))
	{
		_plugin_logputs("[sync] sync failed\n");
		goto Exit;
	}

	_plugin_logputs("[sync] probing sync\n");

	hRes = TunnelSend("[notice]{\"type\":\"new_dbg\",\"msg\":\"dbg connect - x64_dbg\",\"dialect\":\"x64_dbg\"}\n");
	if (FAILED(hRes))
	{
		_plugin_logputs("[sync] sync aborted\n");
		goto Exit;
	}

	_plugin_logprintf("[sync] sync is now enabled with host %s\n", g_DefaultHost);
	UpdateState();
	CreatePollTimer();

Exit:

	return hRes;
}
Esempio n. 2
0
HRESULT
CALLBACK
sync(PDEBUG_CLIENT4 Client, PCSTR Args)
{
    HRESULT hRes=S_OK;
    PCSTR Host;
    PSTR pszId=NULL;

    INIT_API();

    // Reset global state
    g_Base = NULL;
    g_Offset = NULL;

    #if VERBOSE >= 2
    dprintf("[sync] sync function called\n");
    #endif

    if(g_Synchronized)
    {
        dprintf("[sync] sync update\n");
        UpdateState();
        goto exit;
    }

    if (!Args || !*Args) {
        dprintf("[sync] No argument found, using default host (%s:%s)\n", g_DefaultHost, g_DefaultPort);
        Host=g_DefaultHost;
    }else{
        Host=Args;
    }

    if(FAILED(hRes=TunnelCreate(Host, g_DefaultPort)))
    {
        dprintf("[sync] sync failed\n");
        goto exit;
    }

    dprintf("[sync] probing sync\n");

    if(FAILED(hRes=Identity(&pszId)))
    {
        dprintf("[sync] get identity failed\n");
        goto exit;
    }

    hRes=TunnelSend("[notice]{\"type\":\"new_dbg\",\"msg\":\"dbg connect - %s\"}\n", pszId);
    if(SUCCEEDED(hRes))
    {
        dprintf("[sync] sync is now enabled with host %s\n", Host);
        UpdateState();
        CreatePollTimer();
    }
    else
    {
        dprintf("[sync] sync aborted\n");
    }

exit:
    if(!(pszId==NULL))
        free(pszId);

    return hRes;
}