Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssh data processor #8

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
698a891
initial
jdeshin Apr 24, 2019
8b2bd92
add sshdataprocessor class
jdeshin Apr 24, 2019
de130cc
add com object
jdeshin Apr 24, 2019
1417ca9
add key for signing and made assembly as com visible
jdeshin Apr 24, 2019
17abe69
added signed binaries
jdeshin Apr 24, 2019
14f84e0
added signed binaries
jdeshin Apr 24, 2019
af72b6f
Добавлен readme в папку бинарных файлов
jdeshin Apr 25, 2019
651f5f6
Переименован класс ФабрикаКлиентSSH->ФункцииКлиентSSH
jdeshin Apr 25, 2019
71039b3
Поправлен gitignore
jdeshin Apr 27, 2019
c798bfd
Поправлен gitignore
jdeshin Apr 27, 2019
ee21f1d
Удалил ненужные файлы
jdeshin Apr 27, 2019
2ec5dd0
Поправил gitignore
jdeshin Apr 27, 2019
a324a2b
Поправил gitignore
jdeshin Apr 27, 2019
67b4447
Добавил cf файл для работы из 1С:Предприятие
jdeshin Apr 27, 2019
e84585b
Добавил описание COM-объекта в readme
jdeshin Apr 27, 2019
b946963
поправил readme
jdeshin Apr 27, 2019
bf82b92
Добавил описание использования для http-сервиса
jdeshin Apr 27, 2019
f7501bd
поправил readme
jdeshin Apr 27, 2019
dc9a5c6
добавил COM-объект и библиотеку для http-сервисов OneScript
jdeshin Apr 27, 2019
af072b0
Добавил в cf реализацию для работы с каркасной конфигурацией http-сер…
jdeshin Apr 27, 2019
a8b45ec
Добавил класс commandssh.
jdeshin Apr 30, 2019
22fecbd
Удалил неиспользуюмую библиотеку sftp
jdeshin Apr 30, 2019
0130539
Удалил папку с подписанными бинарниками т.к. библиотека Renci.ssh уже…
jdeshin Apr 30, 2019
dc34f5b
Обновил cf. Новая версия - 1.1.0.3
jdeshin Apr 30, 2019
22cbea6
Поправил gitignore
jdeshin Apr 30, 2019
7922d01
Удалил бинарники
jdeshin Apr 30, 2019
62df5d4
Поправил версию в описании библиотеки в cf
jdeshin May 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ packages/
TestApp/bin/

TestApp/obj/
*.lock
*.ide
*.ide-shm
*.ide-wal
*.suo
SshDataProcessor/obj/
SshDataProcessor/bin/
SshDataProcessorCom/obj/
SshDataProcessorCom/bin/
TestSshCom/obj/
TestSshCom/bin/
/SshDataProcessorCom/obj/bin/

SshDataProcessorCom/SignedBinaries/*.dll
1,011 changes: 1,011 additions & 0 deletions .vs/config/applicationhost.config

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions NUnitTests/NUnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@
<EmbeddedResource Include="Tests\testrunner.os" />
<EmbeddedResource Include="Tests\external.os" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,66 @@ Scp.Разорвать();
* Вешается поток если не передать:
`Поток.ЗаписатьВПоток("options set --show-prompt=no --output-format=json");`
* В папке выгрузки создается подпапка с именем пользователя (Особенность режима Агента)

## COM-объект для работы из 1С:Предприятие

Реализация библиотеки в виде COM-объекта, для использования из 1С:Предприятие

## Установка

1. Импортируем подсистему БиблиотекаКлиентSSH в свою конфигурацию
2. Сохраняем содержимое макета COMОбъектБиблиотекаКлиентSSH_БинарныеФайлы как zip-архив
3. Разархивируем содержимое архива на диск
4. Регистрируем библиотеку

```
regasm /codebase ПутьКДлл\SshDataProcessorCom.dll
```

5. Создаем пустое COM+ приложение и добавляем нижеследующие типы:
-SshDataProcessor.ScpCom
-SshDataProcessor.SshClientCom
-SshDataProcessor.SshConnectionCom
-SshDataProcessor.SshDataProcessorCom
-SshDataProcessor.StreamCom

## Пример использования

```1C
// Нижеследующий код используется вместо стандартного
// КлиентSSH = Новый КлиентSSH("127.0.0.1", 1543, "admin", "");
//
КлиентSSH = Обработки.ФункцииКлиентSSH.НовыйКлиентSSH("127.0.0.1", 1543, "admin", "");
// Дальнейшее использование аналогично использованию в среде OneScript
```

## Компонент для использования в OneScript-AspNetEngine

Реализация библиотеки в виде обработки, для использования в [OneScript-AspNetEngine]("https://github.com/jdeshin/OneScript-AspNetEngine").

## Установка

1. Бинарные файлы библиотеки необходимо скопировать в папку Bin, вашего web-приложения
2. Подключить библиотеку oscript-ssh, добавив нижеследующую строку в секцию <appSettings>, файла web.config:

```
<add key="oscript-component" value="attachAssembly" />
```
3. Подключить библиотеку SshDataProcessor, добавив нижеследующую строку в секцию <appSettings>, файла web.config:

```
<add key="SshDataProcessor" value="attachAssembly" />
<add key="attachAsDataProcessor;SshDataProcessor;SshClientFabric.SshClientFabricDataProcessorManager" value="" />
```

## Пример использования

Использование библиотеки из web-приложения OneScript аналогично использованию COM-объекта из среды 1С:Предприятие.

```1C
// Нижеследующий код используется вместо стандартного
// КлиентSSH = Новый КлиентSSH("127.0.0.1", 1543, "admin", "");
//
КлиентSSH = Обработки.ФункцииКлиентSSH.НовыйКлиентSSH("127.0.0.1", 1543, "admin", "");
// Дальнейшее использование аналогично использованию в среде OneScript
```
36 changes: 36 additions & 0 deletions SshDataProcessor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SshDataProcessor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SshDataProcessor")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2f835244-2536-450c-8eb6-300e13cfbdfc")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
84 changes: 84 additions & 0 deletions SshDataProcessor/SshDataProcessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScriptEngine;
using ScriptEngine.HostedScript;
using ScriptEngine.Machine.Contexts;
using ScriptEngine.Machine;
using oscriptcomponent;

namespace SshClientFabric
{
// Это класс менеджера обработки
[ContextClass("ФункцииКлиентSSH", "SSHClientFunctions")]
public class SshClientFabricDataProcessorManager : AutoContext<SshClientFabricDataProcessorManager>
{
public SshClientFabricDataProcessorManager()
{

}

// Метод платформы
[ContextMethod("Создать", "Create")]
public IValue Create()
{
return new SshClientFabricDataProcessorObject();
}

// Статический метод модуля менеджера
[ContextMethod("НовыйКлиентSSH", "NewSSHClient")]
public ClientSsh NewSSHClient(string host, int port, string user, string pass)
{
return new ClientSsh(host, port, user, pass);
}


}

// Это класс модуля объекта обработки
[ContextClass("ФабрикаКлиентSSHОбъект", "ФабрикаКлиентSSHObject")]
public class SshClientFabricDataProcessorObject : AutoContext<SshClientFabricDataProcessorObject>
{
public SshClientFabricDataProcessorObject()
{

}
/*
[ContextProperty("Свойство", "Property")]
public string Property
{
get;
set;
}

[ContextProperty("Свойство", "Property")]
public int Property
{
get;
set;
}

[ContextProperty("Свойство", "Property")]
public int Property
{
get;
set;
}

[ContextProperty("Свойство", "Property")]
public int Property
{
get;
set;
}

[ContextMethod("Сложить", "Add")]
public int Add(int number1, int number2)
{
return number1 + number2;
}
*/
}
}
68 changes: 68 additions & 0 deletions SshDataProcessor/SshDataProcessor.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2F835244-2536-450C-8EB6-300E13CFBDFC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SshDataProcessor</RootNamespace>
<AssemblyName>SshDataProcessor</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ionic.Zip, Version=1.9.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.9.3\lib\net20\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ScriptEngine, Version=1.0.20.107, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OneScript.1.0.20\lib\net452\ScriptEngine.dll</HintPath>
</Reference>
<Reference Include="ScriptEngine.HostedScript, Version=1.0.20.107, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OneScript.StandardLibrary.1.0.20\lib\net452\ScriptEngine.HostedScript.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SshDataProcessor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\oscript-component\oscript-component.csproj">
<Project>{ea173d06-ccd2-45d5-a263-dc866289517a}</Project>
<Name>oscript-component</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
7 changes: 7 additions & 0 deletions SshDataProcessor/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip" version="1.9.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
<package id="OneScript" version="1.0.20" targetFramework="net452" />
<package id="OneScript.StandardLibrary" version="1.0.20" targetFramework="net452" />
</packages>
Binary file added SshDataProcessorCom/1Cv8/1Cv8.cf
Binary file not shown.
1 change: 1 addition & 0 deletions SshDataProcessorCom/1Cv8/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Конфигурация содержит подситему БиблиотекаКлиентSSH для использования библиотеки из 1С:Предприятие
36 changes: 36 additions & 0 deletions SshDataProcessorCom/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SshDataProcessorCom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SshDataProcessorCom")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0c394dd5-ac95-4a96-9d5d-7912c7f23b68")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading