Sunday, May 6, 2012

UDP UPnP Ports Opening from SVCHOST.EXE NETSVCS (range 50k - 60k)

So, i noticed that one of my computers kept opening a UPnP rule on my firewall(if i kept UPnP on), but the other didn't. Searching with netstat -ano gave me the PID, which was svchost.exe netsvcs. Now, this doesn't say much since a lot of services run on svchost. Searching with the port number, or the services wouldn't give much results as the port was dynamic. After some more google persistance i found out the command to list each service that was running in each PID and the name of the services inside. tasklist /svc
Browser, EapHost, gpsvc, IKEEXT, iphlpsvc, LanmanServer, ProfSvc, Schedule, SENS, ShellHWDetection, Themes, Winmgmt, wuauserv
So now i got something similar to this, and by trial and error i eventually found out that, if i stoped IPHLPSVC, i would stop listening to the port. In the end, when i searched the net with IPHLPSVC i found someone with the same questions i had and with some precious tip that might save me time next time:
http://forums.comodo.com/firewall-help-cis/svchostexe-port-57398-whats-going-on-here-t72975.0.html
http://processhacker.sourceforge.net/
This service is somehow responsible by the horrible teredo and other tunnels that appear in your ipconfig list since they invented IPv6. Somehow i suspected when i checked IKEEXT that this would have to do something to do with IPv6. But why did i have this open in one computer and not in the other?
Anyway, just to make sure, i reenabled the service, but nothing happened nevertheless. The UDP port will only get open when you actually attempt to do a IPv6 connection. It seems the UDP port will try to emulate IPv6 connections even if you're using IPv4. Something to try to understand in the future. For now i am happy that I didn't had a worm somewhere...
PS: If you want you can set it off by using netsh interface teredo / set state disabled (set state default - to reenable)

Wednesday, March 7, 2012

github first time

GitHub is free for open-source projects, so let's try to make the excels / forms i've been using into a web project using VS2010.
Since i'm fairly new with VS2010 i went with the usual Web C# project. Installed Git Extensions and followed:

http://help.github.com/set-your-user-name-email-and-github-token/
http://help.github.com/create-a-repo/

Now i created a VS Project inside that directory and when i tried to push i got an error. "No supported authentication methods available"

So, it ends up you need to create a ppk file and configure putty to use it (if you installed github with putty = the default option).

Go ahead to Remotes -> PuTTY -> Generate or import key. Now, go to Conversions -> Import key. Browse to the .ssh folder, and find 'id_rsa' (it was named exactly that here, WITHOUT an extension). Select it, and press open. Enter the password for your key (this is the key that Git uses to communicate to the GitHub server, as it appears). Then, select Save Private Key, and save it somewhere (I did in the .ssh folder)

Now you have the option select the ppk file when the "No supported authentication methods available" arises, and it should work. (of course, you need the private key, silly!).

http://stackoverflow.com/questions/6138493/unable-to-push-to-repository-using-git-extensions

Wednesday, July 20, 2011

A sério, não custava muito pois não?

sc delete bblearn-collab
sc delete bblearn-exec
sc delete bblearn-tomcat
rd /s blackboard
C:\Windows\SysWOW64\inetsrv\appcmd delete site "BBLEARN"

DECLARE @jobId binary(16)
SELECT @jobId = job_id FROM msdb.dbo.sysjobs WHERE (name = N'aa_update_BBLEARN')
IF (@jobId IS NOT NULL)
BEGIN
EXEC msdb.dbo.sp_delete_job @jobId
END
SELECT @jobId = job_id FROM msdb.dbo.sysjobs WHERE (name = N'Fill missing Adaptive tool BBLEARN')
IF (@jobId IS NOT NULL)
BEGIN
EXEC msdb.dbo.sp_delete_job @jobId
END
DROP DATABASE BBLEARN;
DROP DATABASE BBLEARN_admin;
DROP DATABASE BBLEARN_cms;
DROP DATABASE BBLEARN_cms_doc;
DROP DATABASE BBLEARN_stats;
DROP LOGIN BBLEARN;
DROP LOGIN BBLEARN_admin;
DROP LOGIN BBLEARN_cms;
DROP LOGIN BBLEARN_report;
DROP LOGIN BBLEARN_stats;

Thursday, February 10, 2011

Sharepoint e forçar SSL

Quando se quer forçar SSL no sharepoint há que ter em conta o tipo de autenticação que temos implementada.


Se o Sharepoint se encontrar em Windows autentication, podemos aceder à consola de administração do IIS e dentro do tab de directory security seleccionar "require secure channel" ssl. É possível costumizar a resposta de erro 403.4 para redireccionar o cliente a fazer o pedido por https.
http://www.winserverkb.com/Uwe/Forum.aspx/windows-server-sbs/27476/How-to-force-SSL-on-a-SharePoint-site

Caso desejem colocar o sharepoint em forms authentication encontrei este link que mostra como colocar apenas partes do Sharepoint sob SSL (i.e. a página de login).
http://www.sharepointconfig.com/2010/03/enforcing-the-correct-protocol-for-partially-ssl-secured-sharepoint-sites/

Tuesday, November 23, 2010

Como actualizar o Windows/Linux por trás de um proxy com NTLM Authentication

Podem usar as actualizações do Windows/Linux por trás de um proxy com NTLM Authentication, usando um programinha chamado ntlmaps que corre em Python. Este programinha cria um segundo proxy local que é capaz de fazer autenticação no proxy que exige authenticação NTLM. A password pode ser introduzida de forma interactiva.

1 - Instalar o Python e ntlmaps.
2 - Configurar ntlmaps.
3 - Configurar o yum ou o windows para usar o proxy ntlmaps em vez do proxy que está configurado.

Passo 3:
Windows:
netsh winhttp set proxy proxy-server="http=localhost:5865;https=localhost:5865" bypass-list="*.foo.com"
Linux:
export http_proxy=http://localhost:5865
ou actualizar/adicionar a seguinte linha ao yum.conf
proxy=http://localhost:5865

Se com localhost nao estiver a funcionar usem o nome completo da máquina.

http://www.howtoforge.com/how-to-configure-isa-proxy-auth-setting-for-yum
http://technet.microsoft.com/en-us/library/cc731131(WS.10).aspx

Thursday, July 8, 2010

Passing a PARAMETER to a IN CLAUSE

Trying to pass a parameter to a "in clause" can be troublesome, because what you really want to do is to pass an array of an indefinite number of parameters and not a single parameter.

There are 2 solutions for this. Either you pass a table-value type, or you use a function to convert the nvarchar to a table.
Here is how such function might look like:
CREATE FUNCTION iter$simple_intlist_to_tbl (@list nvarchar(MAX))
RETURNS @tbl TABLE (number int NOT NULL) AS
BEGIN
DECLARE @pos int,
@nextpos int,
@valuelen int

SELECT @pos = 0, @nextpos = 1

WHILE @nextpos > 0
BEGIN
SELECT @nextpos = charindex(',', @list, @pos + 1)
SELECT @valuelen = CASE WHEN @nextpos > 0
THEN @nextpos
ELSE len(@list) + 1
END - @pos - 1
INSERT @tbl (number)
VALUES (convert(int, substring(@list, @pos + 1, @valuelen)))
SELECT @pos = @nextpos
END
RETURN
END


For more information about this error and credits for the code here check out:
http://www.sommarskog.se/arrays-in-sql.html